Description
The app currently uses Base.metadata.create_all() to create tables on startup. This doesn't support schema changes without dropping and recreating the database.
Requirements
- Set up Alembic for database migrations
- Create an initial migration from the existing models
- Replace
init_db() in main.py with Alembic's migration runner
- Document migration workflow in README
Tech Notes
- Current DB setup:
backend/app/database.py
- Models:
backend/app/models/
- Alembic needs async support — use
alembic[async] or configure for async SQLAlchemy
- SQLite for dev, but migrations should be PostgreSQL-compatible
Acceptance Criteria
Description
The app currently uses
Base.metadata.create_all()to create tables on startup. This doesn't support schema changes without dropping and recreating the database.Requirements
init_db()inmain.pywith Alembic's migration runnerTech Notes
backend/app/database.pybackend/app/models/alembic[async]or configure for async SQLAlchemyAcceptance Criteria
alembic initstructure exists inbackend/alembic upgrade headworks on a fresh databasealembic revision --autogeneratedetects model changes