38921-vm/db/setup.php
2026-03-01 22:53:30 +00:00

15 lines
443 B
PHP

<?php
require_once __DIR__ . '/config.php';
try {
$migrations = glob(__DIR__ . '/migrations_*.sql');
sort($migrations);
foreach ($migrations as $migration) {
$sql = file_get_contents($migration);
db()->exec($sql);
echo "Executed migration: " . basename($migration) . "\n";
}
echo "Database setup successful.";
} catch (PDOException $e) {
echo "Error setting up database: " . $e->getMessage();
}