Skip to content

Commit 9747f24

Browse files
committed
Try fixing the migration
1 parent 49df85d commit 9747f24

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

pgcommitfest/commitfest/migrations/0018_undo_pg19_final_close.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,17 @@ def undo_pg19_final_close(apps, schema_editor):
5252
if new_poc is None:
5353
continue
5454

55-
# Restore the old poc to its original status
56-
old_poc.status = new_poc.status
55+
# Read the original status from the destination poc (move preserves
56+
# status), then delete it before restoring the source poc. The
57+
# deletion must happen first because poc_enforce_maxoneoutcome_idx
58+
# only allows one non-moved poc per patch.
59+
original_status = new_poc.status
60+
new_poc.delete()
61+
62+
old_poc.status = original_status
5763
old_poc.leavedate = None
5864
old_poc.save()
5965

60-
# Remove the new poc that was created by the move
61-
new_poc.delete()
62-
6366
# Delete the PatchHistory entries for these moves
6467
moved_histories.delete()
6568

0 commit comments

Comments
 (0)