getConnection(); try { // MySQL PDO cannot run multiple statements with exec() sometimes depending on driver, // so we split by semicolon and handle. $statements = array_filter(array_map('trim', explode(';', $sql))); foreach ($statements as $stmt) { if (!empty($stmt)) { $db->exec($stmt); echo "Executed: " . substr($stmt, 0, 50) . "...\n"; } } echo "Migration completed successfully!\n"; } catch (Exception $e) { echo "Migration failed: " . $e->getMessage() . "\n"; exit(1); }