relationships: the cleanup tools stop acting on links that were deleted
Deleting a relationship is soft, so the row survives with isactive False, and three things read them without knowing that. Re-adding a deleted link answered 409 "this relationship already exists" about a link the page no longer shows, and there was no way forward from the UI at all - the row cannot simply be inserted again, since the triple is unique. Reactivating IS the create for an inactive row. The inverse guard blocked on a deleted inverse, which made "remove the existing one first" - the instruction in its own message - fail to unblock anything. fix-controls-direction retired the reversed row whenever a correctly-directed one existed, without checking whether that one was itself deleted. So it removed the only live link and reported a successful clean-up. It now reactivates the row pointing the right way before retiring the one pointing the wrong way. These are the commands the docs tell an operator to run against production.
This commit is contained in:
@@ -738,6 +738,13 @@ def fix_controls_direction():
|
||||
relationshiptypeid=controls.relationshiptypeid,
|
||||
).first()
|
||||
if duplicate:
|
||||
# The correctly-directed row exists - but it may itself be soft
|
||||
# deleted, and deletion here IS soft. Retiring this row without
|
||||
# looking left the pair with NO live link, while the command
|
||||
# reported a successful clean-up. Reactivate the one pointing the
|
||||
# right way before retiring the one pointing the wrong way.
|
||||
if not duplicate.isactive:
|
||||
duplicate.isactive = True
|
||||
row.isactive = False # flipped row already exists, retire this one
|
||||
deactivated += 1
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user