Remove problematic/redudant db migration happning schema 15 (#52541)

This commit is contained in:
Franck Nijhof 2021-07-05 13:28:01 +02:00 committed by GitHub
parent f9c7137d02
commit 5e9127ef7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -347,7 +347,7 @@ def _drop_foreign_key_constraints(connection, engine, table, columns):
)
def _apply_update(engine, session, new_version, old_version): # noqa: C901
def _apply_update(engine, session, new_version, old_version):
"""Perform operations to bring schema up to date."""
connection = session.connection()
if new_version == 1:
@ -451,10 +451,8 @@ def _apply_update(engine, session, new_version, old_version): # noqa: C901
elif new_version == 14:
_modify_columns(connection, engine, "events", ["event_type VARCHAR(64)"])
elif new_version == 15:
if sqlalchemy.inspect(engine).has_table(Statistics.__tablename__):
# Recreate the statistics table
Statistics.__table__.drop(engine)
Statistics.__table__.create(engine)
# This dropped the statistics table, done again in version 18.
pass
elif new_version == 16:
_drop_foreign_key_constraints(
connection, engine, TABLE_STATES, ["old_state_id"]