Closed MichaelMakesGames closed 2 months ago
This seems relevant for going full auto https://alembic.sqlalchemy.org/en/latest/cookbook.html#run-alembic-operation-objects-directly-as-in-from-autogenerate
Still needs some more testing, but got a basic implementation working. It detects and adds the new column on my old origin-less db:
2024-05-15 17:09:05,011 - alembic.autogenerate.compare - INFO - Detected added column 'country.origin'
Currently, any schema change results in a breaking release (old DBs will not work and either need to be deleted or manually edited).
We could use
alembic
(part of the SQLAlchemy project) to automatically compare the saved DBs to the data model, automatically generating and applying migrations. See https://alembic.sqlalchemy.org/en/latest/autogenerate.html#what-does-autogenerate-detect-and-what-does-it-not-detectAlternatively, we could set up alembic to run manually written (or automatically generated then manually reviewed/edited) migrations.