feat: Add PostgreSQL database infrastructure

- Add SQLAlchemy models for User, Translation, ApiKey, UsageLog, PaymentHistory
- Add database connection management with PostgreSQL/SQLite support
- Add repository layer for CRUD operations
- Add Alembic migration setup with initial migration
- Update auth_service to automatically use database when DATABASE_URL is set
- Update docker-compose.yml with PostgreSQL service and Redis (non-optional)
- Add database migration script (scripts/migrate_to_db.py)
- Update .env.example with database configuration
This commit is contained in:
2025-12-31 10:56:19 +01:00
parent c4d6cae735
commit 550f3516db
15 changed files with 1712 additions and 63 deletions

View File

@@ -28,8 +28,7 @@ stripe==7.0.0
# Session storage & caching (optional but recommended for production)
redis==5.0.1
# Database (optional but recommended for production)
# sqlalchemy==2.0.25
# asyncpg==0.29.0 # PostgreSQL async driver
# alembic==1.13.1 # Database migrations
# Database (recommended for production)
sqlalchemy==2.0.25
psycopg2-binary==2.9.9 # PostgreSQL driver
alembic==1.13.1 # Database migrations