Don't emit DROP of version table in offline mode at base (#1822)#1823
Open
imurodl wants to merge 1 commit into
Open
Don't emit DROP of version table in offline mode at base (#1822)#1823imurodl wants to merge 1 commit into
imurodl wants to merge 1 commit into
Conversation
When running ``stamp`` or ``downgrade`` to ``base`` in offline ("--sql")
mode, Alembic emitted a ``DROP TABLE alembic_version`` statement, whereas
the same operations in online mode never drop the version table. This
offline-only DROP, added when the version table was first introduced, was
an inconsistency. Offline mode now matches online behavior and no longer
drops the version table; the table is still created when it does not exist.
Fixes: sqlalchemy#1822
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1822.
As diagnosed by @zzzeek in the issue, offline (
--sql) mode emitted aDROP TABLE alembic_versionwhen runningstampordowngradetobase, while online mode never drops the version table — an inconsistency dating to the version table's introduction.This removes the offline-only
DROPso both modes behave the same. The version table is still created when it does not exist; only the spurious offline drop is gone.Tests
UpgradeDowngradeStampTest::test_version_to_noneto assert the version table is no longer dropped in offline downgrade-to-base.UpgradeDowngradeStampTest::test_sql_stamp_to_base_no_dropregressing the exact scenario from the issue (stamp --sql base).docs/build/unreleased/.Full local run: 1763 passed (the only failures are pre-existing
test_post_write.pyhook tests unrelated to this change).black+flake8clean.