Skip to content

Commit

Permalink
Fix for migrations that do not conform to specification which resulte…
Browse files Browse the repository at this point in the history
…d in the migrationId being blank
  • Loading branch information
andrevanzuydam committed Jan 18, 2024
1 parent 295e358 commit c762911
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Tina4/Database/Migration.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@ final public function doMigration(): string
$fileParts = explode(" ", $fileParts[0]);
//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]);
Expand Down

0 comments on commit c762911

Please sign in to comment.