35089-vm/db/run_migrations.php
Flatlogic Bot e7d7877d01 first
2025-10-21 23:13:27 +00:00

18 lines
411 B
PHP

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