alembic icon indicating copy to clipboard operation
alembic copied to clipboard

Don't emit DROP of version table in offline mode at base (#1822)

Open imurodl opened this issue 5 months ago • 0 comments

Fixes #1822.

As diagnosed by @zzzeek in the issue, offline (--sql) mode emitted a DROP TABLE alembic_version when running stamp or downgrade to base, while online mode never drops the version table — an inconsistency dating to the version table's introduction.

This removes the offline-only DROP so both modes behave the same. The version table is still created when it does not exist; only the spurious offline drop is gone.

Tests

  • Updated UpgradeDowngradeStampTest::test_version_to_none to assert the version table is no longer dropped in offline downgrade-to-base.
  • Added UpgradeDowngradeStampTest::test_sql_stamp_to_base_no_drop regressing the exact scenario from the issue (stamp --sql base).
  • Added a changelog entry under docs/build/unreleased/.

Full local run: 1763 passed (the only failures are pre-existing test_post_write.py hook tests unrelated to this change). black + flake8 clean.

imurodl avatar Jun 27 '26 01:06 imurodl