We consolidated the legacy Alembic history into a single baseline revision that matches the current SQLAlchemy models.
- Revision ID:
c0ce38f74fe0 - Location:
alembic/versions/c0ce38f74fe0_baseline_unified_schema.py - Previous revisions archived under
alembic/versions_archive/
- Back up your production database before performing any changes.
- Use
scripts/db_introspect.pyto inspect existing tables and confirm expected state. - Apply the appropriate path below depending on whether you are provisioning a new database or migrating an existing one.
Run the standard Alembic upgrade against an empty database:
alembic upgrade headThis creates the entire schema defined by the baseline revision.
Because all historical migrations are archived, existing environments only need to acknowledge the new baseline. After taking a backup, manually update the Alembic version table:
-- psql example
BEGIN;
UPDATE alembic_version SET version_num = 'c0ce38f74fe0';
COMMIT;If alembic_version does not exist, create it and insert the revision number:
CREATE TABLE IF NOT EXISTS alembic_version (version_num VARCHAR(32) PRIMARY KEY);
INSERT INTO alembic_version (version_num) VALUES ('c0ce38f74fe0')
ON CONFLICT (version_num) DO NOTHING;tests/test_schema_parity.pyreflects the database schema and compares it to the SQLAlchemy models.- The GitHub Actions backend job now runs
alembic upgrade headagainst Postgres before executing pytest. This keeps CI red if models and migrations drift.
All prior migrations remain available in alembic/versions_archive/ for reference and manual rollback should we need to replay specific operations.