#!/usr/bin/env php
<?php
/**
 * Migration Runner - Remote Version
 */

echo "Starte Migration...\n";

try {
    $pdo = new PDO(
        'pgsql:host=10.255.30.11;port=5433;dbname=fahrschuldesk',
        'fahrschuldesk_api',
        'E8xP2mKjQ9nRtWsLvZ3bVc5YyH1sDe7f'
    );
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    echo "✓ DB verbunden\n";

    $sql = file_get_contents(__DIR__ . '/migration.sql');
    $pdo->exec($sql);
    echo "✓ Migration ausgeführt!\n";

} catch (PDOException $e) {
    echo "✗ Fehler: " . $e->getMessage() . "\n";
    exit(1);
}

echo "Fertig!\n";