35171-vm/db/migrate.php
Flatlogic Bot b88fb2e6d7 son
2025-10-24 09:40:09 +00:00

23 lines
504 B
PHP

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