Lukas
ff0d865b7c
feat: Implement SQLAlchemy database layer with comprehensive models
Implemented a complete database layer for persistent storage of anime series,
episodes, download queue, and user sessions using SQLAlchemy ORM.
Features:
- 4 SQLAlchemy models: AnimeSeries, Episode, DownloadQueueItem, UserSession
- Automatic timestamp tracking via TimestampMixin
- Foreign key relationships with cascade deletes
- Async and sync database session support
- FastAPI dependency injection integration
- SQLite optimizations (WAL mode, foreign keys)
- Enum types for status and priority fields
Models:
- AnimeSeries: Series metadata with one-to-many relationships
- Episode: Individual episodes linked to series
- DownloadQueueItem: Queue persistence with progress tracking
- UserSession: JWT session storage with expiry and revocation
Database Management:
- Async engine creation with aiosqlite
- Session factory with proper lifecycle
- Connection pooling configuration
- Automatic table creation on initialization
Testing:
- 19 comprehensive unit tests (all passing)
- In-memory SQLite for test isolation
- Relationship and constraint validation
- Query operation testing
Documentation:
- Comprehensive database section in infrastructure.md
- Database package README with examples
- Implementation summary document
- Usage guides and troubleshooting
Dependencies:
- Added: sqlalchemy>=2.0.35 (Python 3.13 compatible)
- Added: alembic==1.13.0 (for future migrations)
- Added: aiosqlite>=0.19.0 (async SQLite driver)
Files:
- src/server/database/__init__.py (package exports)
- src/server/database/base.py (base classes and mixins)
- src/server/database/models.py (ORM models, ~435 lines)
- src/server/database/connection.py (connection management)
- src/server/database/migrations.py (migration placeholder)
- src/server/database/README.md (package documentation)
- tests/unit/test_database_models.py (19 test cases)
- DATABASE_IMPLEMENTATION_SUMMARY.md (implementation summary)
Closes #9 Database Layer implementation task
2025-10-17 20:46:21 +02:00
..
2025-10-12 23:17:20 +02:00
2025-10-14 21:53:41 +02:00
2025-10-14 21:57:20 +02:00
2025-10-12 23:49:04 +02:00
2025-10-13 00:03:02 +02:00
2025-10-17 20:05:57 +02:00
2025-10-14 21:43:48 +02:00
2025-10-17 20:26:40 +02:00
2025-10-17 20:46:21 +02:00
2025-10-12 23:17:20 +02:00
2025-10-17 09:55:55 +02:00
2025-10-17 10:07:16 +02:00
2025-10-12 23:33:56 +02:00
2025-10-13 00:18:46 +02:00
2025-10-17 11:12:06 +02:00
2025-10-17 19:45:36 +02:00
2025-10-17 19:13:37 +02:00
2025-10-17 12:01:22 +02:00
2025-10-17 12:01:22 +02:00
2025-10-17 10:59:53 +02:00