generated from opensafely-core/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The officially supported route for migrations in SQLAlchemy is Alembic but for these purposes this is overkill and brings a lot of unnecessary complexity. This commit makes `_ensure_table`` check if columns have been added or removed (does not support alterations to column types or nullability) and ensures that the database schema is in sync with the table schemata defined in tables.py. Adding `NOT NULL` columns requires that a default value specification is given. `reset_table` requires that the drop table is committed before `_ensure_table` is called again because of nuances of SQLAlchemy's metadata lifecycle.
- Loading branch information
1 parent
447ecb9
commit 7ede4ae
Showing
2 changed files
with
78 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters