diff --git a/Tina4/Database/Migration.php b/Tina4/Database/Migration.php index 69232ce3..8c1f21c2 100644 --- a/Tina4/Database/Migration.php +++ b/Tina4/Database/Migration.php @@ -148,11 +148,6 @@ final public function doMigration(): string //Get first 14 characters (length of migration id column) $migrationId = substr($fileParts[0], 0, 14); - //Fix if we end up with weird migrations which do not conform to the spec - if (empty($migrationId)) { - $migrationId = substr($entry, 0, 14); - } - //Get the rest of the string $leftOverFileParts = substr($fileParts[0], 14, strlen($fileParts[0])); unset($fileParts[0]); @@ -168,6 +163,11 @@ final public function doMigration(): string $migrationText = $leftOverFileParts . implode(" ", $fileParts); } + //Fix if we end up with weird migrations which do not conform to the spec + if (empty($migrationId)) { + $migrationId = substr($entry, 0, 14); + } + $sqlCheck = "select * from tina4_migration where migration_id = '{$migrationId}'"; $record = $this->DBA->fetch($sqlCheck)->AsObject(); if (!empty($record)) {