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:
parent
b40a4dce18
commit
3867bc36cf
5
config/migrations/005_drop_unused_columns.sql
Normal file
5
config/migrations/005_drop_unused_columns.sql
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
ALTER TABLE settings
|
||||||
|
DROP COLUMN show_tick_mood;
|
||||||
|
|
||||||
|
ALTER TABLE user
|
||||||
|
DROP COLUMN about;
|
@ -92,8 +92,16 @@ class Database{
|
|||||||
throw new Exception("Could not read migration file: $file");
|
throw new Exception("Could not read migration file: $file");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute the migration SQL
|
// Remove comments and split by semicolon
|
||||||
$db->exec($sql);
|
$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
|
// Update db version
|
||||||
|
Loading…
x
Reference in New Issue
Block a user