<?php
require_once __DIR__ . '/../config/config.php';
$db = Database::getInstance();
$dir = __DIR__ . '/../migrations';
$files = glob($dir . '/*.sql');
foreach ($files as $f) {
    echo "Running migration: " . basename($f) . "\n";
    $sql = file_get_contents($f);
    try {
        $db->execute($sql);
        echo "OK\n";
    } catch (Exception $e) {
        echo "Failed: " . $e->getMessage() . "\n";
    }
}
echo "Migrations completed.\n";