feat(migrations): T11 setup Alembic and initial schema migration

- Initialize Alembic with alembic init alembic
- Configure alembic.ini to use DATABASE_URL from environment
- Configure alembic/env.py to import Base and models metadata
- Generate initial migration: c92fc544a483_initial_schema
- Migration creates all 4 tables: users, api_keys, api_tokens, usage_stats
- Migration includes all indexes, constraints, and foreign keys
- Test upgrade/downgrade cycle works correctly

Alembic commands:
- alembic upgrade head
- alembic downgrade -1
- alembic revision --autogenerate -m 'message'

Tests: 13 migration tests pass
This commit is contained in:
Luca Sacchi Ricciardi
2026-04-07 11:14:45 +02:00
parent ea198e8b0d
commit abe9fc166b
6 changed files with 603 additions and 2 deletions

View File

@@ -44,13 +44,13 @@
- [x] T04: Setup file configurazione (.env, config.py) (2024-04-07)
- [x] T05: Configurare pytest e struttura test (2024-04-07)
### 🗄️ Database & Models (T06-T11) - 5/6 completati
### 🗄️ Database & Models (T06-T11) - 6/6 completati
- [x] T06: Creare database.py (connection & session) - ✅ Completato (2026-04-07 11:00)
- [x] T07: Creare model User (SQLAlchemy) - ✅ Completato (2026-04-07 11:15)
- [x] T08: Creare model ApiKey (SQLAlchemy) - ✅ Completato (2026-04-07 11:15)
- [x] T09: Creare model UsageStats (SQLAlchemy) - ✅ Completato (2026-04-07 11:15)
- [x] T10: Creare model ApiToken (SQLAlchemy) - ✅ Completato (2026-04-07 11:15)
- [ ] T11: Setup Alembic e creare migrazione iniziale - 🟡 In progress
- [x] T11: Setup Alembic e creare migrazione iniziale - ✅ Completato (2026-04-07 11:20)
### 🔐 Servizi di Sicurezza (T12-T16) - 0/5 completati
- [ ] T12: Implementare EncryptionService (AES-256)