ea6c466c6c
- Add init_database() with alembic programmatic API and retry logic - Add connection retry with exponential backoff (5 attempts) - Improve error messages for connection/auth failures - Add table existence check before seeding data - Update startup event to run migrations before seeding - Add wait-for-db.sh script for Docker containers - Update Docker and docker-compose configurations Quality gates: ruff ✓, mypy ✓, unit tests (8 passed)
28 lines
999 B
Markdown
28 lines
999 B
Markdown
## 1. Database Initialization
|
|
|
|
- [x] 1.1 Create `init_database()` function in `apps/api/src/database.py`
|
|
- [x] 1.2 Add alembic programmatic upgrade call
|
|
- [x] 1.3 Add connection retry logic with backoff
|
|
- [x] 1.4 Modify startup event to call `init_database()` before seeding
|
|
- [x] 1.5 Update seed functions to check table existence first
|
|
|
|
## 2. Error Handling and Logging
|
|
|
|
- [x] 2.1 Add clear error messages for connection failures
|
|
- [x] 2.2 Add clear error messages for missing tables
|
|
- [x] 2.3 Add clear error messages for auth failures
|
|
- [x] 2.4 Log migration status on startup
|
|
|
|
## 3. Docker Integration
|
|
|
|
- [x] 3.1 Update Dockerfile to wait for database readiness
|
|
- [x] 3.2 Update docker-compose files with init order
|
|
- [x] 3.3 Add health check script for database
|
|
|
|
## 4. Testing
|
|
|
|
- [x] 4.1 Test with fresh database (no tables)
|
|
- [x] 4.2 Test with existing database (migrations already applied)
|
|
- [x] 4.3 Test database connection failure handling
|
|
- [x] 4.4 Run quality gates (ruff, mypy, pytest)
|