Commit Graph

2 Commits

Author SHA1 Message Date
Luca Sacchi Ricciardi
26fb4a276f feat(database): create all core tables with migrations
Add database migrations for mockupAWS v0.2.0:

- DB-003: scenario_logs table
  * Stores received log entries with SHA256 hash for deduplication
  * PII detection flags
  * Metrics: size_bytes, token_count, sqs_blocks
  * Indexes on scenario_id, received_at, message_hash, has_pii

- DB-004: scenario_metrics table
  * Time-series storage for metrics aggregation
  * Supports: sqs, lambda, bedrock, safety metric types
  * Flexible JSONB metadata field
  * BRIN index on timestamp for efficient queries

- DB-005: aws_pricing table
  * Stores AWS service pricing by region
  * Supports price history with effective_from/to dates
  * Active pricing flag for current rates
  * Index on service, region, tier combination

- DB-006: reports table
  * Generated report tracking
  * Supports PDF and CSV formats
  * File path and size tracking
  * Metadata JSONB for extensibility

All tables include:
- UUID primary keys with auto-generation
- Foreign key constraints with CASCADE delete
- Appropriate indexes for query performance
- Check constraints for data validation

Tasks: DB-003, DB-004, DB-005, DB-006 complete
2026-04-07 13:53:07 +02:00
Luca Sacchi Ricciardi
6f03c33ab5 feat(database): setup alembic and create scenarios table
- Install alembic and asyncpg for database migrations
- Configure alembic for async SQLAlchemy 2.0
- Create initial migration for scenarios table:
  * UUID primary key with auto-generation
  * Status enum (draft, running, completed, archived)
  * JSONB tags with GIN index
  * Timestamps with auto-update trigger
  * Check constraints for name/region validation
  * Indexes on status, region, created_at
- Test database connection and migration

Task: DB-001, DB-002 complete
2026-04-07 13:48:05 +02:00