diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2019-08-28 15:00:02 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2019-09-09 22:56:03 +0200 |
commit | ed58343e60e8fed3fe0104e3f334a116a528959f (patch) | |
tree | 2d91b86d7d0dfe09496a445df2f8c55102fcc858 /apps/workflowengine/lib/Migration | |
parent | 827dd896fa903bb86f3434034952bb0e435a230c (diff) | |
download | nextcloud-server-ed58343e60e8fed3fe0104e3f334a116a528959f.tar.gz nextcloud-server-ed58343e60e8fed3fe0104e3f334a116a528959f.zip |
split events DB field into entity and events, adjust biz logic
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/workflowengine/lib/Migration')
-rw-r--r-- | apps/workflowengine/lib/Migration/PopulateNewlyIntroducedDatabaseFields.php | 13 | ||||
-rw-r--r-- | apps/workflowengine/lib/Migration/Version2019Date20190808074233.php | 12 |
2 files changed, 21 insertions, 4 deletions
diff --git a/apps/workflowengine/lib/Migration/PopulateNewlyIntroducedDatabaseFields.php b/apps/workflowengine/lib/Migration/PopulateNewlyIntroducedDatabaseFields.php index 43595d1c7cf..8b3f3d5a9c3 100644 --- a/apps/workflowengine/lib/Migration/PopulateNewlyIntroducedDatabaseFields.php +++ b/apps/workflowengine/lib/Migration/PopulateNewlyIntroducedDatabaseFields.php @@ -25,6 +25,7 @@ declare(strict_types=1); namespace OCA\WorkflowEngine\Migration; use Doctrine\DBAL\Driver\Statement; +use OCA\WorkflowEngine\Entity\File; use OCP\IDBConnection; use OCP\Migration\IOutput; use OCP\Migration\IRepairStep; @@ -49,6 +50,18 @@ class PopulateNewlyIntroducedDatabaseFields implements IRepairStep { $this->populateScopeTable($result); $result->closeCursor(); + + $this->populateEntityCol(); + } + + protected function populateEntityCol() { + $qb = $this->dbc->getQueryBuilder(); + + $qb->update('flow_operations') + ->set('entity', File::class) + ->where($qb->expr()->emptyString('entity')) + ->execute(); + } protected function populateScopeTable(Statement $ids): void { diff --git a/apps/workflowengine/lib/Migration/Version2019Date20190808074233.php b/apps/workflowengine/lib/Migration/Version2019Date20190808074233.php index 2b9a8aa17cd..ffea3c88d01 100644 --- a/apps/workflowengine/lib/Migration/Version2019Date20190808074233.php +++ b/apps/workflowengine/lib/Migration/Version2019Date20190808074233.php @@ -70,12 +70,12 @@ class Version2019Date20190808074233 extends SimpleMigrationStep { $table->addColumn('operation', Type::TEXT, [ 'notnull' => false, ]); - $this->addEventsColumn($table); + $this->addEntityColumns($table); $table->setPrimaryKey(['id']); } else { $table = $schema->getTable('flow_operations'); - if(!$table->hasColumn('events')) { - $this->addEventsColumn($table); + if(!$table->hasColumn('entity')) { + $this->addEntityColumns($table); } } @@ -105,7 +105,11 @@ class Version2019Date20190808074233 extends SimpleMigrationStep { return $schema; } - protected function addEventsColumn(Table $table) { + protected function addEntityColumns(Table $table) { + $table->addColumn('entity', Type::STRING, [ + 'notnull' => true, + 'length' => 256, + ]); $table->addColumn('events', Type::TEXT, [ 'notnull' => true, 'default' => '[]', |