Skip to content

Add database migrations with Alembic #6

Description

@darshacharya

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

  • alembic init structure exists in backend/
  • Initial migration captures all existing models
  • alembic upgrade head works on a fresh database
  • alembic revision --autogenerate detects model changes
  • README documents how to create and run migrations

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendBackend relatedenhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions