-
Notifications
You must be signed in to change notification settings - Fork 68
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
Fix broken and incomplete mscolab migration scripts and flask-migrate setup #2416
Comments
There will necessarily be a transition period where production databases don't have their alembic_version set, so some manual steps will be required (mainly |
I merge with #2417 |
Currently we have a not standard solution for doing migrations on a server. The knowledge was gained when the documentation was updated #2410 The solution should become similiar to https://docs.djangoproject.com/en/5.0/topics/migrations/ On django the managment command is named manage.py on our mscolab server it is mscolab.py We should implement similiar options as django has. Because on flask's migration I had several times that I needed to modify the created migrations script, we maybe need to figure too why that is needed. mscolab db --migrate mscolab db --makemigrations mscolab db --init mscolab db --reset mscolab db --reset mscolab db --sqlmigrate mscolab db --showmigrations mscolab db --start There are more db commands currently maybe they should be moved to different category as db or cli scripts. This also means we have to take care/applying migrations during development. |
We need at lease one before to start from and rollback. 8 is ok for me |
There is nothing to figure out, this is by design. Alembic can not always figure out the correct migration path, it is expected that the generated migration script needs to be adapted in some way and the result then committed to the repository. This is the standard mode of operation for flask-migrate.
This should also happen automatically on startup of mscolab.
Since this should never be done outside of development I don't think we should expose an option on mscolab for that. Instead, we can document the correct
This could be merged with
|
I should have detailed that we use sqlite for development and postgres on the server. One of the earlier updates scripts had crashed on the postgres dbase and I needed to fix it by a sed on a dump. |
Whatever it uses internally I don't want to change the mscolab command to flask as a command. |
ok, for developer it is ok to use flask. This also makes it better to define what's for the users |
Yes, we also need CI test runs against other databases if we want to support them. This kind of incompatibility is the reason why I don't really like ORMs and trying to abstract over multiple SQL databases, it is often just not possible... |
Yes, |
Well, if we properly use flask-migrate there is no difference: recreating from scratch is the same as applying all migrations one after another. The only difference might be the existing data in the database. But we should have automated tests for all possible upgrade paths and also all possible rollbacks, in my opinion.
Three options:
|
The migration scripts in mslib/mscolab/migrations are incomplete and broken, as in the ones that are there can not be applied.
What should be done IMO:
flask_migrate.check
should be a good starting point)flask db upgrade
worksdb --init
), rely on flask-migrate insteadflask db migrate
This came up in #2410.
The text was updated successfully, but these errors were encountered: