Problem
Currently, the test suite uses erase_and_rebuild_db() in tests/__init__.py which creates tables directly from SQLAlchemy models using Base.metadata.create_all(). This means alembic migrations are never tested.
This creates a gap where:
- Model changes pass tests but migrations may fail
- Migration scripts may have errors not caught until deployed
- Schema drift between models and migrations goes undetected
Proposed Solution
Add integration tests that:
- Start from a clean database
- Run
alembic upgrade head
- Verify expected tables and columns exist
- Optionally test
alembic downgrade paths
Acceptance Criteria
Related
Discovered while implementing BDMS-434 (MinorTraceChemistry migration)
Problem
Currently, the test suite uses
erase_and_rebuild_db()intests/__init__.pywhich creates tables directly from SQLAlchemy models usingBase.metadata.create_all(). This means alembic migrations are never tested.This creates a gap where:
Proposed Solution
Add integration tests that:
alembic upgrade headalembic downgradepathsAcceptance Criteria
Related
Discovered while implementing BDMS-434 (MinorTraceChemistry migration)