This document describes the migration workflow that is directly evidenced in the current repository.
- Alembic is configured in
alembic/env.py. - Active revisions are under
alembic/versions/. - Container startup runs
uv run alembic upgrade headbefore serving the API (scripts/entrypoint.sh).
The current active revision sequence in alembic/versions/ is:
0001_initial_schema0002_update_taxon_cols0003_assembly_run_github0004_qc_reads_assembly_refs0005_add_tolid_requests
- Ensure the app can resolve
DATABASE_URI. - Apply migrations:
uv run alembic upgrade head- Run the test suite:
pytest -qdocker-compose.ymlstarts the API container.- The API container entrypoint waits for the database and then runs:
uv run alembic upgrade head- If
APP_MODE=migrate, the entrypoint exits after migrations instead of starting the API.
The comment at the top of schema.sql states that the file should be kept in sync with the database after migrations and regenerated using a schema-only pg_dump.
The verified instruction in schema.sql is:
docker compose exec db pg_dump -U <user> -d <dbname> --schema-only --no-owner --no-acl| Revision | Verified focus |
|---|---|
0002_update_taxon_cols |
Removes outdated taxonomy columns and adds assembly.hic_specimen_sample_ids |
0003_assembly_run_github |
Reworks assembly reporting around assembly_run and assembly_stage_run |
0004_qc_reads_assembly_refs |
Reworks QC-read reporting and adds the qc_read_assembly link table |
0005_add_tolid_requests |
Adds durable ToLID request state |
- Add or update the Alembic revision under
alembic/versions/. - Apply the migration to a local database.
- Update
schema.sqlso it matches the post-migration schema snapshot. - Run tests.
- Update maintainer-facing docs if the schema change affects workflows or operations.
- There is no verified production rollback runbook in this repository.
- There is no verified repository-local command for creating new Alembic revisions documented here; the repo only proves how revisions are applied, not the team’s preferred authoring command.