Commit Graph

6 Commits

Author SHA1 Message Date
Adrian Flores Cortes
45d5825bb3 docs(database): Add timestamp standardization plan and migration template
- Document current TIMESTAMPTZ compliance across all schemas
- Create comprehensive migration template for future use
- Include validation queries and best practices
- Add examples for different timezone scenarios
2026-02-04 00:01:32 -06:00
Adrian Flores Cortes
82d6e608b1 [ST-4.1] feat: Add optimized partial index for auth.users.locked_until
- Create migration 2026-02-03_add_auth_locked_index.sql
- Add partial index on locked_until with active lockout condition
- Replace previous generic locked_until index with optimized version
- Index filters for locked_until IS NOT NULL AND locked_until > NOW()
- Improves query performance for account unlock validation
- Resolves GAP-009

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 23:56:26 -06:00
Adrian Flores Cortes
6da2786590 [TASK-2026-02-03-ANALISIS-DDL-MODELADO] feat(ddl): FASE-3 Moderate P1 gaps
ST-3.1: Course tags system
- education.course_tags with slug, color, featured flag
- education.course_tag_assignments (M:N) with auto usage_count
- Seeds: 10 initial tags (forex, crypto, ICT, etc.)

ST-3.2: Drawing tools for charts
- Enum: trading.drawing_tool_type (18 types including ICT)
- trading.drawing_tools with JSONB points and styles
- trading.drawing_templates for reusable presets

ST-3.3: Complete agent_executions
- Added 10 columns: execution_time_ms, slippage, risk_score, etc.
- 5 new performance indexes
- Trigger for updated_at

ST-3.4: ML composite indexes
- 8 new composite/partial indexes for predictions
- Optimized for symbol+timeframe+date queries
- Partial indexes for high confidence and overlay display

New files: 7 DDL, 2 migrations, 1 seed
Modified: 3 existing DDL files

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 23:55:24 -06:00
Adrian Flores Cortes
f64251e459 [TASK-2026-02-03-ANALISIS-DDL-MODELADO] refactor(ddl): FASE-2 Conflicts & Duplications
ST-2.1: Unify timeframe enum
- Created ddl/00-global-types.sql with public.trading_timeframe
- Marked trading.timeframe and market_data.timeframe as DEPRECATED

ST-2.2: Resolve transaction_type conflict
- Documented rename plan: financial.wallet_transaction_type
- Documented rename plan: investment.investment_transaction_type
- Added deprecation comments to both enums

ST-2.3: Unify common functions
- Created ddl/00-global-functions.sql with public.update_updated_at()
- Marked schema-specific functions as DEPRECATED:
  - auth.update_updated_at()
  - education.update_updated_at_column()
  - financial.update_timestamp()
  - feature_flags.update_timestamp()

Migrations created (not executed):
- 2026-02-03_unify_timeframe_enum.sql
- 2026-02-03_rename_transaction_type_enums.sql
- 2026-02-03_unify_common_functions.sql

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 23:51:08 -06:00
Adrian Flores Cortes
c651fe5a30 [TASK-2026-02-03-ANALISIS-DDL-MODELADO] feat(ddl): FASE-1 Gaps Críticos P0
ST-1.1: financial.refunds - Already exists with approval flow
ST-1.2: education.instructors - Created with GIN indexes
ST-1.3: trading.price_alerts - FK exists, idempotent migration added
ST-1.4: ml.prediction_overlays - New table + overlay columns

New files:
- ddl/schemas/education/tables/17-instructors.sql
- ddl/schemas/ml/tables/12-prediction_overlays.sql
- migrations/2026-02-03_add_predictions_overlay.sql
- migrations/2026-02-03_add_price_alerts_symbol_fk.sql

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 23:45:39 -06:00
Adrian Flores Cortes
2a6d8367d8 feat: Update DDL schemas and add new structures
DDL updates:
- Update extensions and schemas configuration
- Add sessions table for auth schema
- Update education schema (videos, install/uninstall scripts)
- Add backtest_runs and llm_signals tables for ML schema

Scripts:
- Update database creation and migration scripts
- Add DDL validation script

New:
- Add migrations directory structure
- Add production seeds for auth, investment, market_data, trading

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 12:24:23 -06:00