# DDL-VALIDATION-MATRIX.yml # Matriz de validación DDL vs Requerimientos # Tarea: TASK-2026-02-03-ANALISIS-DDL-MODELADO metadata: fecha_creacion: "2026-02-03" fecha_actualizacion: "2026-02-03" total_schemas: 11 total_tablas: 90 coherencia_global: "87%" resumen_validacion: schemas_completos: 7 schemas_con_gaps: 3 schema_sin_ddl: 1 # MT4 (decisión pendiente) metricas: tablas_ddl: 90 tablas_documentadas: 82 match_rate: "91%" enums_ddl: 68 enums_usados: 65 enums_huerfanos: 3 fk_definidas: 102 fk_faltantes: 4 indices_definidos: 200 indices_sugeridos: 12 validacion_por_schema: auth: estado: "COMPLETO" completitud: "100%" tablas: - nombre: "users" existe_ddl: true existe_entity: true campos_match: true indices: ["email", "status", "role", "last_login"] notas: "Falta índice locked_until (P2)" - nombre: "user_profiles" existe_ddl: true existe_entity: true campos_match: true - nombre: "oauth_accounts" existe_ddl: true existe_entity: true campos_match: true - nombre: "sessions" existe_ddl: true existe_entity: true campos_match: true - nombre: "email_verifications" existe_ddl: true existe_entity: true campos_match: true - nombre: "phone_verifications" existe_ddl: true existe_entity: true campos_match: true - nombre: "password_reset_tokens" existe_ddl: true existe_entity: true campos_match: true - nombre: "auth_logs" existe_ddl: true existe_entity: true campos_match: true - nombre: "login_attempts" existe_ddl: true existe_entity: true campos_match: true - nombre: "rate_limiting_config" existe_ddl: true existe_entity: true campos_match: true - nombre: "notifications" existe_ddl: true existe_entity: true campos_match: true - nombre: "user_push_tokens" existe_ddl: true existe_entity: true campos_match: true enums_validados: - user_status: true - user_role: true - oauth_provider: true - phone_channel: true - mfa_method: true - auth_event_type: true education: estado: "GAPS MENORES" completitud: "82%" gaps: - "instructors no existe (P0)" - "course_tags no existe (P1)" - "course_reviews sin soft delete (P2)" tablas: - nombre: "categories" existe_ddl: true existe_entity: true campos_match: true - nombre: "courses" existe_ddl: true existe_entity: true campos_match: true notas: "Falta FK instructor_id" - nombre: "modules" existe_ddl: true existe_entity: true campos_match: true - nombre: "lessons" existe_ddl: true existe_entity: true campos_match: true - nombre: "enrollments" existe_ddl: true existe_entity: true campos_match: true - nombre: "progress" existe_ddl: true existe_entity: true campos_match: true - nombre: "quizzes" existe_ddl: true existe_entity: true campos_match: true - nombre: "quiz_questions" existe_ddl: true existe_entity: true campos_match: true - nombre: "quiz_attempts" existe_ddl: true existe_entity: true campos_match: true - nombre: "certificates" existe_ddl: true existe_entity: true campos_match: true - nombre: "user_achievements" existe_ddl: true existe_entity: true campos_match: true - nombre: "user_gamification_profile" existe_ddl: true existe_entity: true campos_match: true - nombre: "user_activity_log" existe_ddl: true existe_entity: true campos_match: true - nombre: "course_reviews" existe_ddl: true existe_entity: true campos_match: true notas: "Falta deleted_at" - nombre: "videos" existe_ddl: true existe_entity: true campos_match: true - nombre: "review_helpful_votes" existe_ddl: true existe_entity: true campos_match: true - nombre: "instructors" existe_ddl: false existe_entity: false gap: "P0" trading: estado: "GAPS MODERADOS" completitud: "91%" gaps: - "price_alerts sin FK symbol_id (P0)" - "drawing_tools no existe (P1)" tablas: - nombre: "symbols" existe_ddl: true existe_entity: true campos_match: true - nombre: "watchlists" existe_ddl: true existe_entity: true campos_match: true - nombre: "watchlist_items" existe_ddl: true existe_entity: true campos_match: true - nombre: "bots" existe_ddl: true existe_entity: true campos_match: true - nombre: "orders" existe_ddl: true existe_entity: true campos_match: true - nombre: "positions" existe_ddl: true existe_entity: true campos_match: true - nombre: "trades" existe_ddl: true existe_entity: true campos_match: true - nombre: "signals" existe_ddl: true existe_entity: true campos_match: true - nombre: "trading_metrics" existe_ddl: true existe_entity: true campos_match: true - nombre: "paper_balances" existe_ddl: true existe_entity: true campos_match: true - nombre: "price_alerts" existe_ddl: true existe_entity: true campos_match: false gap: "Falta FK symbol_id" financial: estado: "GAP CRÍTICO" completitud: "91%" gaps: - "refunds no existe (P0 - BLOQUEANTE)" tablas: - nombre: "wallets" existe_ddl: true existe_entity: true campos_match: true - nombre: "wallet_transactions" existe_ddl: true existe_entity: true campos_match: true - nombre: "subscriptions" existe_ddl: true existe_entity: true campos_match: true - nombre: "invoices" existe_ddl: true existe_entity: true campos_match: true - nombre: "payments" existe_ddl: true existe_entity: true campos_match: true - nombre: "wallet_audit_log" existe_ddl: true existe_entity: true campos_match: true - nombre: "currency_exchange_rates" existe_ddl: true existe_entity: true campos_match: true - nombre: "wallet_limits" existe_ddl: true existe_entity: true campos_match: true - nombre: "customers" existe_ddl: true existe_entity: true campos_match: true - nombre: "payment_methods" existe_ddl: true existe_entity: true campos_match: true - nombre: "refunds" existe_ddl: false existe_entity: false gap: "P0 - BLOQUEANTE" investment: estado: "COMPLETO CON GAPS" completitud: "90%" gaps: - "agent_executions incompleta (P1)" tablas: - nombre: "products" existe_ddl: true existe_entity: true campos_match: true - nombre: "risk_questionnaire" existe_ddl: true existe_entity: true campos_match: true - nombre: "accounts" existe_ddl: true existe_entity: true campos_match: true - nombre: "distributions" existe_ddl: true existe_entity: true campos_match: true - nombre: "transactions" existe_ddl: true existe_entity: true campos_match: true - nombre: "withdrawal_requests" existe_ddl: true existe_entity: true campos_match: true - nombre: "daily_performance" existe_ddl: true existe_entity: true campos_match: true - nombre: "distribution_history" existe_ddl: true existe_entity: true campos_match: true - nombre: "distribution_runs" existe_ddl: true existe_entity: true campos_match: true - nombre: "agent_executions" existe_ddl: true existe_entity: true campos_match: false gap: "Columnas faltantes" portfolio: estado: "COMPLETO" completitud: "100%" tablas: - nombre: "portfolios" existe_ddl: true existe_entity: true campos_match: true - nombre: "portfolio_allocations" existe_ddl: true existe_entity: true campos_match: true - nombre: "portfolio_goals" existe_ddl: true existe_entity: true campos_match: true - nombre: "rebalance_history" existe_ddl: true existe_entity: true campos_match: true - nombre: "portfolio_snapshots" existe_ddl: true existe_entity: true campos_match: true market_data: estado: "COMPLETO" completitud: "100%" tablas: - nombre: "ohlcv_5m" existe_ddl: true existe_entity: true campos_match: true - nombre: "ohlcv_15m" existe_ddl: true existe_entity: true campos_match: true - nombre: "staging" existe_ddl: true existe_entity: true campos_match: true ml: estado: "GAPS MENORES" completitud: "82%" gaps: - "overlay predicciones incompleto (P0)" - "índice compuesto faltante (P1)" - "símbolos como strings, no FK" tablas: - nombre: "models" existe_ddl: true existe_entity: true campos_match: true - nombre: "model_versions" existe_ddl: true existe_entity: true campos_match: true - nombre: "predictions" existe_ddl: true existe_entity: true campos_match: true notas: "Falta índice compuesto" - nombre: "prediction_outcomes" existe_ddl: true existe_entity: true campos_match: true - nombre: "feature_store" existe_ddl: true existe_entity: false gap: "Entity faltante" - nombre: "llm_predictions" existe_ddl: true existe_entity: true campos_match: true - nombre: "llm_prediction_outcomes" existe_ddl: true existe_entity: true campos_match: true - nombre: "llm_decisions" existe_ddl: true existe_entity: true campos_match: true - nombre: "risk_events" existe_ddl: true existe_entity: true campos_match: true - nombre: "backtest_runs" existe_ddl: true existe_entity: true campos_match: true - nombre: "llm_signals" existe_ddl: true existe_entity: true campos_match: true llm: estado: "COMPLETO" completitud: "100%" gaps: - "índice GIN en tags (P2)" tablas: - nombre: "conversations" existe_ddl: true existe_entity: true campos_match: true - nombre: "messages" existe_ddl: true existe_entity: true campos_match: true - nombre: "user_preferences" existe_ddl: true existe_entity: true campos_match: true - nombre: "user_memory" existe_ddl: true existe_entity: true campos_match: true - nombre: "embeddings" existe_ddl: true existe_entity: true campos_match: true audit: estado: "COMPLETO" completitud: "86%" gaps: - "compliance_logs sin entity (P2)" - "particionamiento pendiente (P2)" tablas: - nombre: "audit_logs" existe_ddl: true existe_entity: true campos_match: true - nombre: "security_events" existe_ddl: true existe_entity: true campos_match: true - nombre: "system_events" existe_ddl: true existe_entity: true campos_match: true - nombre: "trading_audit" existe_ddl: true existe_entity: true campos_match: true - nombre: "api_request_logs" existe_ddl: true existe_entity: true campos_match: true - nombre: "data_access_logs" existe_ddl: true existe_entity: true campos_match: true - nombre: "compliance_logs" existe_ddl: true existe_entity: false gap: "Entity faltante" feature_flags: estado: "COMPLETO" completitud: "100%" tablas: - nombre: "flags" existe_ddl: true existe_entity: true campos_match: true - nombre: "user_flags" existe_ddl: true existe_entity: true campos_match: true - nombre: "evaluations" existe_ddl: true existe_entity: true campos_match: true mt4: estado: "NO EXISTE" completitud: "0%" nota: "Decisión pendiente MetaAPI vs Local Terminal" dependencia: "OQI-009" acciones_requeridas: P0_inmediato: - schema: "financial" accion: "Crear tabla refunds" esfuerzo: "8h" - schema: "education" accion: "Crear tabla instructors" esfuerzo: "10h" - schema: "trading" accion: "Agregar FK a price_alerts" esfuerzo: "6h" - schema: "ml" accion: "Completar overlay predicciones" esfuerzo: "8h" P1_corto_plazo: - schema: "education" accion: "Crear tabla course_tags" esfuerzo: "6h" - schema: "trading" accion: "Crear tablas drawing_tools" esfuerzo: "12h" - schema: "investment" accion: "Completar agent_executions" esfuerzo: "4h" - schema: "ml" accion: "Crear índice compuesto" esfuerzo: "2h" P2_mediano_plazo: - schema: "auth" accion: "Índice locked_until" - schema: "education" accion: "Soft delete en reviews" - schema: "audit" accion: "Particionamiento" - schema: "llm" accion: "Índice GIN tags" - schema: "*" accion: "Estandarizar timestamps"