From 28cdfd29536b64f898ac97d448c0c2eade644a08 Mon Sep 17 00:00:00 2001 From: Andre van Zuydam Date: Thu, 18 Jan 2024 11:55:27 +0200 Subject: [PATCH] Fix for migrations that do not conform to specification which resulted in the migrationId being blank --- Tina4/Database/Migration.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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)) {