37484-vm/db/migrations/migrate.php
Flatlogic Bot bdb61800b1 01
2026-01-15 15:23:12 +00:00

23 lines
525 B
PHP

<?php
require_once __DIR__ . '/../config.php';
function run_migrations() {
$pdo = db();
$migrations_dir = __DIR__;
$files = glob($migrations_dir . '/*.sql');
sort($files);
foreach ($files as $file) {
$sql = file_get_contents($file);
try {
$pdo->exec($sql);
echo "Migration from $file ran successfully.\n";
} catch (PDOException $e) {
echo "Error running migration from $file: " . $e->getMessage() . "\n";
}
}
}
run_migrations();