35628-vm/db/migrate.php
Flatlogic Bot 6252def608 project 1
2025-11-10 18:35:06 +00:00

21 lines
465 B
PHP

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