From 48f9e32c22913d48f31fab7b240f378f056c1b8e Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Fri, 3 Jul 2026 00:47:54 -0500 Subject: [PATCH] chore(migrations): script para correr migraciones pendientes de una vez Co-Authored-By: Claude Sonnet 4.6 --- migrations/run_pendientes.php | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 migrations/run_pendientes.php diff --git a/migrations/run_pendientes.php b/migrations/run_pendientes.php new file mode 100644 index 0000000..58b43f4 --- /dev/null +++ b/migrations/run_pendientes.php @@ -0,0 +1,40 @@ +getConnection(); +$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + +echo "\n── Migraciones pendientes ──────────────────\n\n"; + +foreach ($pendientes as $file) { + $path = __DIR__ . '/' . $file; + if (!file_exists($path)) { + echo " ⚠ No encontrado: $file\n"; + continue; + } + try { + $pdo->exec(file_get_contents($path)); + echo " ✅ $file\n"; + } catch (PDOException $e) { + // Si ya existe la columna/tabla, no es error crítico + $msg = $e->getMessage(); + if (str_contains($msg, 'Duplicate column') || str_contains($msg, 'already exists')) { + echo " ⏭ $file (ya aplicada)\n"; + } else { + echo " ❌ $file → $msg\n"; + } + } +} + +echo "\n── Listo ───────────────────────────────────\n\n";