diff options
-rw-r--r-- | apps/workflowengine/lib/Migration/PopulateNewlyIntroducedDatabaseFields.php | 4 | ||||
-rw-r--r-- | apps/workflowengine/lib/Migration/Version2019Date20190808074233.php | 28 |
2 files changed, 17 insertions, 15 deletions
diff --git a/apps/workflowengine/lib/Migration/PopulateNewlyIntroducedDatabaseFields.php b/apps/workflowengine/lib/Migration/PopulateNewlyIntroducedDatabaseFields.php index 8b3f3d5a9c3..f715ebc7ef7 100644 --- a/apps/workflowengine/lib/Migration/PopulateNewlyIntroducedDatabaseFields.php +++ b/apps/workflowengine/lib/Migration/PopulateNewlyIntroducedDatabaseFields.php @@ -58,7 +58,7 @@ class PopulateNewlyIntroducedDatabaseFields implements IRepairStep { $qb = $this->dbc->getQueryBuilder(); $qb->update('flow_operations') - ->set('entity', File::class) + ->set('entity', $qb->createNamedParameter(File::class)) ->where($qb->expr()->emptyString('entity')) ->execute(); @@ -70,8 +70,8 @@ class PopulateNewlyIntroducedDatabaseFields implements IRepairStep { $insertQuery = $qb->insert('flow_operations_scope'); while($id = $ids->fetchColumn(0)) { $insertQuery->values(['operation_id' => $qb->createNamedParameter($id), 'type' => IManager::SCOPE_ADMIN]); + $insertQuery->execute(); } - $insertQuery->execute(); } protected function getIdsWithoutScope(): Statement { diff --git a/apps/workflowengine/lib/Migration/Version2019Date20190808074233.php b/apps/workflowengine/lib/Migration/Version2019Date20190808074233.php index ffea3c88d01..6ac48616b16 100644 --- a/apps/workflowengine/lib/Migration/Version2019Date20190808074233.php +++ b/apps/workflowengine/lib/Migration/Version2019Date20190808074233.php @@ -70,13 +70,11 @@ class Version2019Date20190808074233 extends SimpleMigrationStep { $table->addColumn('operation', Type::TEXT, [ 'notnull' => false, ]); - $this->addEntityColumns($table); + $this->ensureEntityColumns($table); $table->setPrimaryKey(['id']); } else { $table = $schema->getTable('flow_operations'); - if(!$table->hasColumn('entity')) { - $this->addEntityColumns($table); - } + $this->ensureEntityColumns($table); } if (!$schema->hasTable('flow_operations_scope')) { @@ -105,14 +103,18 @@ class Version2019Date20190808074233 extends SimpleMigrationStep { return $schema; } - protected function addEntityColumns(Table $table) { - $table->addColumn('entity', Type::STRING, [ - 'notnull' => true, - 'length' => 256, - ]); - $table->addColumn('events', Type::TEXT, [ - 'notnull' => true, - 'default' => '[]', - ]); + protected function ensureEntityColumns(Table $table) { + if(!$table->hasColumn('entity')) { + $table->addColumn('entity', Type::STRING, [ + 'notnull' => true, + 'length' => 256, + ]); + } + if(!$table->hasColumn('events')) { + $table->addColumn('events', Type::TEXT, [ + 'notnull' => true, + 'default' => '[]', + ]); + } } } |