Update: 2026-05-07 15:49:13
This commit is contained in:
22
scratch/run_migration.php
Normal file
22
scratch/run_migration.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
require 'app/bootstrap.php';
|
||||
|
||||
$sql = file_get_contents('scratch/stage0_db_update.sql');
|
||||
$db = \App\Core\Database::getInstance()->getConnection();
|
||||
|
||||
try {
|
||||
// MySQL PDO cannot run multiple statements with exec() sometimes depending on driver,
|
||||
// so we split by semicolon and handle.
|
||||
$statements = array_filter(array_map('trim', explode(';', $sql)));
|
||||
|
||||
foreach ($statements as $stmt) {
|
||||
if (!empty($stmt)) {
|
||||
$db->exec($stmt);
|
||||
echo "Executed: " . substr($stmt, 0, 50) . "...\n";
|
||||
}
|
||||
}
|
||||
echo "Migration completed successfully!\n";
|
||||
} catch (Exception $e) {
|
||||
echo "Migration failed: " . $e->getMessage() . "\n";
|
||||
exit(1);
|
||||
}
|
||||
Reference in New Issue
Block a user