-
-
Notifications
You must be signed in to change notification settings - Fork 234
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
alembic current command shouldn't mutate the database #694
Comments
agree, the creation of the table is part of a fixed workflow and some effort would need to be taken to figure out how to break this cycle in the case of a command like "current". some flag would need to be passed thorugh. any interest on working on a PR ? |
this should do it :
|
Yes, but it seems that you've already nailed it :) I've opened a PR (#695) and added a simple test for this behavior. |
Nikolay Edigaryev has proposed a fix for this issue in the master branch: Ensure "alembic current" won't unnecessarily mutate the database https://gerrit.sqlalchemy.org/c/sqlalchemy/alembic/+/1970 |
I'm getting this error in CI (GitHub) with v. 1.12.1 inside a docker container. Anyone know if it was resolved? My workaround:
|
Can you open a new issue. Your workaround will create the table so I'm not sure it's the same issue |
I have a case where two types of Kubernetes applications are using the same database schema. Before they are started, the following happens:
alembic current
in loop waiting for migrations to be appliedalembic upgrade head
before it startsThis "locking" mechanism causes problems due to how
alembic current
is implemented. It's description says:However besides displaying the revision it also tries to create an empty
alembic_version
table, which may cause race conditions when multiplealembic current
commands are being run in parallel:In fact, it does not make sense to create anything since the output after creation looks like this (the same amount of information could be provided without creating anything):
It would be nice if
alembic current
would implement an early exit ifalembic_version
table does not exist.The text was updated successfully, but these errors were encountered: