summaryrefslogtreecommitdiffstats
path: root/apps/workflowengine/lib
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2019-08-08 10:29:17 +0200
committerArthur Schiwon <blizzz@arthur-schiwon.de>2019-09-09 22:56:01 +0200
commit9a6f7cc8cb5aef8d0c9dfb29fbed4a02e331e647 (patch)
tree0ef6c3dbc36f4aa24f07af51f705ef87d2d42973 /apps/workflowengine/lib
parent445d6eb8394fa8db68f2f856d8a141eb1cebd34b (diff)
downloadnextcloud-server-9a6f7cc8cb5aef8d0c9dfb29fbed4a02e331e647.tar.gz
nextcloud-server-9a6f7cc8cb5aef8d0c9dfb29fbed4a02e331e647.zip
add scope table for workflows and switch to migrations
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/workflowengine/lib')
-rw-r--r--apps/workflowengine/lib/Migration/Version2019Date20190808074233.php100
1 files changed, 100 insertions, 0 deletions
diff --git a/apps/workflowengine/lib/Migration/Version2019Date20190808074233.php b/apps/workflowengine/lib/Migration/Version2019Date20190808074233.php
new file mode 100644
index 00000000000..cedee43a9eb
--- /dev/null
+++ b/apps/workflowengine/lib/Migration/Version2019Date20190808074233.php
@@ -0,0 +1,100 @@
+<?php
+
+declare(strict_types=1);
+
+namespace OCA\WorkflowEngine\Migration;
+
+use Closure;
+use Doctrine\DBAL\Types\Type;
+use OCP\DB\ISchemaWrapper;
+use OCP\Migration\SimpleMigrationStep;
+use OCP\Migration\IOutput;
+
+class Version2019Date20190808074233 extends SimpleMigrationStep {
+
+ /**
+ * @param IOutput $output
+ * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
+ * @param array $options
+ * @return null|ISchemaWrapper
+ */
+ public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
+ /** @var ISchemaWrapper $schema */
+ $schema = $schemaClosure();
+
+ if (!$schema->hasTable('flow_checks')) {
+ $table = $schema->createTable('flow_checks');
+ $table->addColumn('id', Type::INTEGER, [
+ 'autoincrement' => true,
+ 'notnull' => true,
+ 'length' => 4,
+ ]);
+ $table->addColumn('class', Type::STRING, [
+ 'notnull' => true,
+ 'length' => 256,
+ ]);
+ $table->addColumn('operator', Type::STRING, [
+ 'notnull' => true,
+ 'length' => 16,
+ ]);
+ $table->addColumn('value', Type::TEXT, [
+ 'notnull' => false,
+ ]);
+ $table->addColumn('hash', Type::STRING, [
+ 'notnull' => true,
+ 'length' => 32,
+ ]);
+ $table->setPrimaryKey(['id']);
+ $table->addUniqueIndex(['hash'], 'flow_unique_hash');
+ }
+
+ if (!$schema->hasTable('flow_operations')) {
+ $table = $schema->createTable('flow_operations');
+ $table->addColumn('id', Type::INTEGER, [
+ 'autoincrement' => true,
+ 'notnull' => true,
+ 'length' => 4,
+ ]);
+ $table->addColumn('class', Type::STRING, [
+ 'notnull' => true,
+ 'length' => 256,
+ ]);
+ $table->addColumn('name', Type::STRING, [
+ 'notnull' => true,
+ 'length' => 256,
+ ]);
+ $table->addColumn('checks', Type::TEXT, [
+ 'notnull' => false,
+ ]);
+ $table->addColumn('operation', Type::TEXT, [
+ 'notnull' => false,
+ ]);
+ $table->setPrimaryKey(['id']);
+ }
+
+ if (!$schema->hasTable('flow_operations_scope')) {
+ $table = $schema->createTable('flow_operations_scope');
+ $table->addColumn('id', Type::BIGINT, [
+ 'autoincrement' => true,
+ 'notnull' => true,
+ 'length' => 4,
+ ]);
+ $table->addColumn('operation_id', Type::INTEGER, [
+ 'notnull' => true,
+ 'length' => 4,
+ ]);
+ $table->addColumn('type', Type::INTEGER, [
+ 'notnull' => true,
+ 'length' => 4,
+ ]);
+ $table->addColumn('value', Type::STRING, [
+ 'notnull' => false,
+ 'length' => 64,
+ ]);
+ $table->setPrimaryKey(['id']);
+ $table->addUniqueIndex(['operation_id', 'type', 'value'], 'flow_unique_scope');
+ }
+
+ return $schema;
+ }
+}