#!/usr/bin/env php getConnection(); $migrations = [ '20260704_lis_01_catalogos_base.sql', '20260704_lis_02_protocolos.sql', '20260704_lis_03_perfiles.sql', '20260704_lis_04_exam_ampliar.sql', '20260704_lis_05_tarifas.sql', '20260704_lis_06_historico.sql', '20260704_lis_07_turnero_muestras.sql', '20260704_lis_08_vistas.sql', ]; $dir = __DIR__ . '/migrations/'; foreach ($migrations as $file) { $path = $dir . $file; echo "Ejecutando $file... "; try { $sql = file_get_contents($path); // Separar por ; para ejecutar sentencia a sentencia foreach (array_filter(array_map('trim', explode(';', $sql))) as $stmt) { if ($stmt !== '') $pdo->exec($stmt); } echo "OK\n"; } catch (\Throwable $e) { echo "ERROR: " . $e->getMessage() . "\n"; } } echo "\nMigraciones LIS completadas. Ahora ejecuta el ETL:\n"; echo " cd migrations/etl && cp config.php config.local.php\n"; echo " # editar config.local.php con credenciales Firebird\n"; echo " php run_etl.php --dry-run # prueba sin insertar\n"; echo " php run_etl.php # migración real\n";