Alembic setup#579
Conversation
|
Nice setup overall — the initial migration, the round-trip tests, and the CI check are all solid. A few things I think are worth addressing before merge: init_db.py runs both create_all() and migrations. Right now
Small one in env.py: One note on the tests: they run against in-memory SQLite, which is great for verifying up/down/round-trip mechanics. Just worth keeping in mind that since the app runs on Postgres, migrations using Postgres-specific types (JSONB, etc. — which the #544 models will use) won't be exercised by these. Not a blocker for this PR, just relevant for what comes next. Happy to re-review once you've had a look. |
We are adding more models soon (#544) and the current
create_all()approach can only create tables, not alter them. This PR sets up Alembic so we can track and apply schema changes going forward.Changes
alembictorequirements.txtalembic.ini,alembic/env.py, andalembic/script.py.mako001_initial_schema.py) that captures the existingTemplateandFormSubmissiontablesapp/db/init_db.pyto runalembic upgrade headinstead ofcreate_all()create_all()with in-memory SQLite for speedalembic checkstep in CI to catch missing migrationsmake migrateandmake migrationcommandsPart of #541
Fix: #578