34494-vm/db/migrate.php
Flatlogic Bot 5acb599929 v2
2025-09-30 03:50:50 +00:00

20 lines
463 B
PHP

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