Closes #25 (#26)
Some checks failed
Build and publish artifacts / build-and-publish (push) Has been cancelled
Run unit tests / run-unit-tests (push) Has been cancelled

Co-authored-by: Greg Sarjeant <1686767+gsarjeant@users.noreply.github.com>
Reviewed-on: https://gitea.subcultureofone.org/greg/tkr/pulls/26
This commit is contained in:
greg 2025-07-24 18:49:32 +00:00
parent b40a4dce18
commit 3867bc36cf
2 changed files with 15 additions and 2 deletions

View File

@ -0,0 +1,5 @@
ALTER TABLE settings
DROP COLUMN show_tick_mood;
ALTER TABLE user
DROP COLUMN about;

View File

@ -92,8 +92,16 @@ class Database{
throw new Exception("Could not read migration file: $file");
}
// Execute the migration SQL
$db->exec($sql);
// Remove comments and split by semicolon
$sql = preg_replace('/--.*$/m', '', $sql);
$statements = preg_split('/;\s*$/m', $sql, -1, PREG_SPLIT_NO_EMPTY);
// Execute each statement
foreach ($statements as $statement){
if (!empty($statement)){
$db->exec($statement);
}
}
}
// Update db version