Skip to content

Commit

Permalink
Fix error during direct DB upgrade from v2 to v3.3
Browse files Browse the repository at this point in the history
We used the same `merge_map` temp table in two revisions, but since
there is no commit in between, it's still around when the second
revision runs. We now `DROP` it explicitly right after using it to
avoid this. Creating it `IF NOT EXISTS` would have been an alternative
options, but the benefit is minimal and alembic revisions should be
self-contained.
  • Loading branch information
ThiefMaster committed May 8, 2024
1 parent 0de4683 commit 61aacd1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Expand Up @@ -41,6 +41,8 @@ def upgrade():
JOIN merge_map mm2 ON (mm2.user_id = r3.user_id AND mm2.current_user_id = mm.current_user_id)
WHERE r3.registration_form_id = r.registration_form_id AND mm2.user_id != r.user_id
);
DROP TABLE merge_map;
''')


Expand Down
Expand Up @@ -30,6 +30,8 @@ def upgrade():
SET user_id = mm.current_user_id
FROM merge_map mm
WHERE mm.user_id = eml.user_id AND mm.current_user_id != eml.user_id;
DROP TABLE merge_map;
''')


Expand Down

0 comments on commit 61aacd1

Please sign in to comment.