-
Karel van Klink authoredKarel van Klink authored
test_migrations.py 605 B
import pytest
from alembic.migration import MigrationContext
from sqlalchemy import create_engine
@pytest.mark.noautofixt()
def test_migrations_no_branches(db_uri):
engine = create_engine(db_uri)
conn = engine.connect()
context = MigrationContext.configure(conn)
assert len(context.get_current_heads()) == 1, (
"\n\n!!!\n\nDetected a branching of db migrations. This is caused by multiple `down_revision`s referring to the"
" same migration.\n\nPlease resolve this by updating either one of these migrations: "
f"{context.get_current_heads()}.\n\n!!!\n\n"
)