diff --git a/lib/Migration/Version1Date20241111144800.php b/lib/Migration/Version1Date20241111144800.php index 69a8e44..9eb4651 100644 --- a/lib/Migration/Version1Date20241111144800.php +++ b/lib/Migration/Version1Date20241111144800.php @@ -101,10 +101,17 @@ public function postSchemaChange(IOutput $output, Closure $schemaClosure, array && $table->hasColumn('source_id') === true && $table->hasColumn('source_hash') === true ) { $this->connection->executeQuery(" - UPDATE openconnector_synchronization_contracts - SET origin_id = source_id, origin_hash = source_hash - WHERE source_id IS NOT NULL - "); + UPDATE openconnector_synchronization_contracts + SET origin_id = source_id, origin_hash = source_hash + WHERE source_id IS NOT NULL + "); + } + + if ($table->hasColumn('source_id') === true) { + $table->dropColumn('source_id'); + } + if ($table->hasColumn('source_hash') === true) { + $table->dropColumn('source_hash'); } } } diff --git a/lib/Migration/Version1Date20241112143200.php b/lib/Migration/Version1Date20241112143200.php deleted file mode 100644 index 3775bbd..0000000 --- a/lib/Migration/Version1Date20241112143200.php +++ /dev/null @@ -1,63 +0,0 @@ -connection = $connection; - } - - /** - * @param IOutput $output - * @param Closure(): ISchemaWrapper $schemaClosure - * @param array $options - */ - public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { - } - - /** - * @param IOutput $output - * @param Closure(): ISchemaWrapper $schemaClosure - * @param array $options - * @return null|ISchemaWrapper - */ - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { - - // Step 3: Drop the old columns after data migration - /** - * @var ISchemaWrapper $schema - */ - $schema = $schemaClosure(); - $table = $schema->getTable('openconnector_synchronization_contracts'); - - if ($table->hasColumn('source_id') === true) { - $table->dropColumn('source_id'); - } - if ($table->hasColumn('source_hash') === true) { - $table->dropColumn('source_hash'); - } - - return $schema; - } -}