36153-vm/db/migrate.php
Flatlogic Bot 33d80b482d 2
2025-11-23 21:35:27 +00:00

23 lines
522 B
PHP

<?php
require_once __DIR__ . '/config.php';
try {
$pdo = db();
$migrationsDir = __DIR__ . '/migrations';
$files = glob($migrationsDir . '/*.sql');
sort($files);
foreach ($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());
}