v26.05.26.4 — hotfix: migration 0022 pre-DELETE colliding ImageProvenance before UPDATE #26
Reference in New Issue
Block a user
Delete Branch "dev"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Third hotfix for v26.05.26.1's alembic 0022 migration. Same row-by-row UNIQUE pattern as v26.05.26.2/3, just one level deeper.
What broke this time
Image 82045 had
ImageProvenancerows pointing at BOTH post 5411 (the keep) AND post 14147 (the drop) — legitimately, because the same image was attached to two different Posts that we're now merging. When the migration triedUPDATE image_provenance SET post_id = 5411 WHERE post_id = 14147, the new row (82045, 5411) collided with the existing one.My prior code did "UPDATE then dedupe-DELETE" but
uq_image_provenance_image_post(alembic 0021) fires row-by-row during the UPDATE — the after-the-fact dedupe never runs.Fix
Pre-DELETE
image_provenancerows underdropwhoseimage_record_idalready has a provenance underkeep. Those rows are redundant — the keep-side provenance already represents that (image, post) link. Then the remaining drop-side provenance rows get UPDATEd cleanly.Also includes the dev-only ruff B007 fix (
eee1077) and the cache-step removal (1803a09).Test plan
:latest. Alembic should apply 0022 cleanly through all three collision patterns now (Post epid collision case A, Post epid collision case B, ImageProvenance pre-existing pair).🤖 Generated with Claude Code