Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic DB migrations #151

Closed
MichaelMakesGames opened this issue May 13, 2024 · 2 comments · Fixed by #153
Closed

Automatic DB migrations #151

MichaelMakesGames opened this issue May 13, 2024 · 2 comments · Fixed by #153
Assignees
Labels
enhancement New feature or request python Pull requests that update Python code

Comments

@MichaelMakesGames
Copy link
Collaborator

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-detect

Alternatively, we could set up alembic to run manually written (or automatically generated then manually reviewed/edited) migrations.

@MichaelMakesGames MichaelMakesGames added dependencies Pull requests that update a dependency file python Pull requests that update Python code enhancement New feature or request and removed dependencies Pull requests that update a dependency file labels May 13, 2024
@MichaelMakesGames
Copy link
Collaborator Author

@MichaelMakesGames
Copy link
Collaborator Author

Still needs some more testing, but got a basic implementation working. It detects and adds the new column on my old origin-less db:
Screenshot from 2024-05-15 17-10-00

2024-05-15 17:09:05,011 - alembic.autogenerate.compare - INFO - Detected added column 'country.origin'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request python Pull requests that update Python code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant