34921-vm/db/migrate.php
Flatlogic Bot e6ade2ba41 1.8
2025-10-14 14:13:08 +00:00

22 lines
510 B
PHP

<?php
require_once __DIR__ . '/config.php';
try {
$pdo = db();
$migration_files = glob(__DIR__ . '/migrations/*.sql');
sort($migration_files);
foreach ($migration_files as $file) {
echo "Running migration: " . basename($file) . "...\n";
$sql = file_get_contents($file);
$pdo->exec($sql);
echo "Success.\n";
}
echo "\nAll migrations completed successfully!\n";
} catch (PDOException $e) {
die("Database migration failed: " . $e->getMessage());
}