34957-vm/db/migrate.php
Flatlogic Bot 480576a9e7 login
2025-10-14 13:44:29 +00:00

27 lines
651 B
PHP

<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require_once 'config.php';
try {
$pdo = db();
$migrations = glob(__DIR__ . '/migrations/*.sql');
sort($migrations);
foreach ($migrations as $migration) {
$sql = file_get_contents($migration);
if ($sql) {
$pdo->exec($sql);
echo "Executed migration: " . basename($migration) . "<br>";
}
}
echo "All migrations executed successfully.<br>";
} catch (PDOException $e) {
header('HTTP/1.1 500 Internal Server Error');
die("Database migration failed: " . $e->getMessage());
}