Drop indexes on renamed table
avoid naming conflicts on recreate (indexes are not renamed, and keeping them on backup tables does not really make sense). fixes #1396
This commit is contained in:
@@ -100,6 +100,9 @@ def check_migrate(engine) -> None:
|
||||
|
||||
# Schema migration necessary
|
||||
engine.execute(f"alter table trades rename to {table_back_name}")
|
||||
# drop indexes on backup table
|
||||
for index in inspector.get_indexes(table_back_name):
|
||||
engine.execute(f"drop index {index['name']}")
|
||||
# let SQLAlchemy create the schema as required
|
||||
_DECL_BASE.metadata.create_all(engine)
|
||||
|
||||
|
Reference in New Issue
Block a user