36352-vm/db/migrate.php
Flatlogic Bot e15fa31a20 t6
2025-11-27 10:42:12 +00:00

22 lines
527 B
PHP

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