fix(versioning): retention task FK violation on cross-entity transactions
When one ORM flush touches multiple versioned entities (dashboard + slice + dataset all save at tx=X), each gets a shadow row sharing that tx. If only the dashboard is later edited at tx=Y, the dashboard row at tx=X is closed (end_tx=Y) while slice/dataset rows stay live at tx=X. Retention then preserves tx=X (slice/dataset are live there) and prunes tx=Y. The dashboard's closed row at tx=X survives step 1, then its end_transaction_id=Y trips the FK when step 2 deletes version_transaction row Y. Fix: extend the shadow-row delete to also match end_transaction_id IN tx_ids. Live rows have end_tx=NULL so they're never matched by either predicate. Closed rows that touch a pruned tx at either endpoint are pruned together — consistent with retention semantics (any tx in the row's lifespan is gone, so the row's chain is broken anyway). Unblocks test_retention_prunes_old_rows on sqlite, mysql, postgres.
M
Mike Bridge committed
0c79581ee9ce1da0215ad06356f048947af141b6
Parent: d0520f6