Skip to content

Commit 56890a8

Browse files
committed
Really fix deletion failure
The migration code to fix #62 left the old, non-cascading table around, which still prevented the deletion; this drops the obsolete table to fix it properly.
1 parent a1e73cf commit 56890a8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

sogs/migrations/import_hacks.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ def migrate(conn, *, check_only):
2020

2121
changed = False
2222

23+
# Older version of the table edit migration didn't drop the old table:
24+
if 'old_room_import_hacks' in db.metadata.tables:
25+
logging.warning("Dropping old_room_import_hacks temporary table")
26+
if check_only:
27+
raise DatabaseUpgradeRequired("old_room_import_hacks")
28+
conn.execute('DROP TABLE old_room_import_hacks')
29+
changed = True
30+
2331
if 'file_id_hacks' in db.metadata.tables:
2432
# If the table exists but is empty (i.e. because all the attachments expired) then we should
2533
# drop it.
@@ -108,6 +116,7 @@ def migrate(conn, *, check_only):
108116
FROM old_room_import_hacks
109117
"""
110118
)
119+
conn.execute('DROP TABLE old_room_import_hacks')
111120

112121
changed = True
113122

0 commit comments

Comments
 (0)