35636-vm/db/migrate.php
Flatlogic Bot 7d531ef9a4 1
2025-11-11 08:51:27 +00:00

21 lines
472 B
PHP

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