prepare( 'SELECT COUNT(*) AS c ' . 'FROM information_schema.columns ' . 'WHERE table_schema = DATABASE() AND table_name = ? AND column_name = ?' ); $checkColumnStmt->execute(['marketing_videos', 'observacion']); $row = $checkColumnStmt->fetch(PDO::FETCH_ASSOC); $count = (int)($row['c'] ?? 0); if ($count === 0) { $file = __DIR__ . '/../db/migrations/086_add_observacion_to_marketing_videos.sql'; if (!is_file($file)) { throw new RuntimeException('No se encontró la migración: ' . basename($file)); } $sql = file_get_contents($file); if ($sql === false) { throw new RuntimeException('No se pudo leer la migración: ' . basename($file)); } $pdo->exec($sql); } }