<?php
require_once 'config.php';

$migration_file = end($argv);

if (!file_exists($migration_file)) {
    die("Migration file not found: $migration_file");
}

$sql = file_get_contents($migration_file);
$db = db();

try {
    $db->exec($sql);
    echo "Migration successful: $migration_file\n";
} catch (PDOException $e) {
    die("Migration failed: " . $e->getMessage() . "\n");
}