mAi
4cd28bc896
feat(db): mig 152 — dedupe identical sequencing_rule clones (5 archived) (t-paliad-321 / m/paliad#144 follow-up)
...
Mig 151 (t-paliad-319) archived 5 of 6 duplicate procedural_events for
"Mängelbeseitigung / Zahlung" and reparented their sequencing_rules
onto the canonical PE. The 6 sequencing_rules themselves were left
active — and they are byte-for-byte clones (proceeding_type_id=NULL,
rule_code=NULL, duration 14d, primary_party=NULL, condition_expr=NULL,
…). The admin shows six indistinguishable rows for one legal concept.
This migration archives 5 of 6, keeping the row with the
lexicographically lowest UUID as canonical.
Pre-write verification (Supabase MCP, 2026-05-26):
- Exactly 1 clone-group surfaces under the full-signature query
(procedural_event_id, proceeding_type_id, rule_code, duration_*,
primary_party, condition_expr::text, trigger_event_id, alt_*,
anchor_alt, combine_op, parent_id, is_spawn, spawn_*):
6 "Mängelbeseitigung / Zahlung" rows.
- 0 paliad.deadlines reference any of the 5 to-be-archived rows
(verified via deadlines.sequencing_rule_id JOIN; rule_id column
was dropped in mig 140 / Slice B.4).
- Other name-duplicates (Antrag auf Patentänderung×4, Beginn des
Hauptsacheverfahrens×2, Berufungsbegründung-R.220.1×2,
Berufungsschrift-R.220.1×2) do NOT collapse under this signature —
their proceeding_type_id / rule_code / duration / primary_party
differ. Legitimately distinct rules per proceeding. This mig
leaves them alone.
Migration shape (mirrors mig 151):
1. Build dedupe mapping (duplicate_id → canonical_id) into a
ROW_NUMBER() OVER (PARTITION BY full-signature ORDER BY
created_at, id::text) TEMP table.
2. PRE NOTICE: surface every clone-group with its canonical + dups
so the deploy log shows what's about to be touched (m may want
to spot-check).
3. Snapshot the duplicates into paliad.sequencing_rules_pre_152
(precedent pre_091/093/095/098/140/151).
4. Reparent paliad.deadlines.sequencing_rule_id duplicate → canonical
BEFORE archiving (defensive no-op today).
5. set_config('paliad.audit_reason', …) — defensive; sequencing_rules
has no audit trigger yet (mig 151 §scope verified), but a future
trigger would inherit the reason automatically.
6. UPDATE sequencing_rules SET is_active=false,
lifecycle_state='archived' WHERE id IN dups.
7. POST assertions: expected archive count met, zero clone groups
remaining in active+published, zero live deadlines pointing at
an archived sequencing_rule. RAISE EXCEPTION on any mismatch.
Down: best-effort revert (flips archived → published from snapshot).
Doesn't undo the deadlines reparent (live data didn't need one;
snapshot doesn't carry pre-state of deadlines).
Build + vet clean. TestMigrations_NoDuplicateSlot passes.
2026-05-26 21:21:38 +02:00
..
2026-04-16 13:54:19 +02:00
2026-04-16 13:54:19 +02:00
2026-04-16 13:54:19 +02:00
2026-04-16 13:54:19 +02:00
2026-04-16 13:54:19 +02:00
2026-04-16 13:54:19 +02:00
2026-04-16 13:54:19 +02:00
2026-04-30 03:42:25 +02:00
2026-04-16 13:54:19 +02:00
2026-04-30 03:42:25 +02:00
2026-04-16 13:54:19 +02:00
2026-04-30 03:42:25 +02:00
2026-04-16 13:54:19 +02:00
2026-04-16 13:54:19 +02:00
2026-04-16 13:54:19 +02:00
2026-04-16 13:54:19 +02:00
2026-04-16 13:54:19 +02:00
2026-04-16 13:54:19 +02:00
2026-04-16 13:54:19 +02:00
2026-04-16 13:54:19 +02:00
2026-04-16 13:54:19 +02:00
2026-04-16 13:54:19 +02:00
2026-04-16 17:11:02 +02:00
2026-04-16 17:11:02 +02:00
2026-04-17 11:59:49 +02:00
2026-04-17 11:59:49 +02:00
2026-04-17 13:54:32 +02:00
2026-04-17 13:54:32 +02:00
2026-04-18 20:26:11 +02:00
2026-04-18 20:26:11 +02:00
2026-04-20 12:34:38 +02:00
2026-04-20 12:34:38 +02:00
2026-04-20 13:17:24 +02:00
2026-04-20 13:17:24 +02:00
2026-04-20 17:35:38 +02:00
2026-04-20 17:35:38 +02:00
2026-04-20 17:35:38 +02:00
2026-04-20 17:35:38 +02:00
2026-04-23 01:00:31 +02:00
2026-04-23 01:00:31 +02:00
2026-04-25 23:37:51 +02:00
2026-04-25 23:37:51 +02:00
2026-04-27 11:47:10 +02:00
2026-04-27 11:47:10 +02:00
2026-04-27 14:59:03 +02:00
2026-04-27 14:59:03 +02:00
2026-04-27 19:34:56 +02:00
2026-05-25 17:42:06 +02:00
2026-04-28 13:05:22 +02:00
2026-04-28 13:05:22 +02:00
2026-04-29 22:09:39 +02:00
2026-04-29 22:09:39 +02:00
2026-04-30 03:42:25 +02:00
2026-05-25 17:42:06 +02:00
2026-04-30 10:54:46 +02:00
2026-04-30 10:54:46 +02:00
2026-04-30 11:11:47 +02:00
2026-04-30 11:11:47 +02:00
2026-04-30 12:49:04 +02:00
2026-04-30 12:49:04 +02:00
2026-04-30 16:41:38 +02:00
2026-04-30 16:41:38 +02:00
2026-05-04 14:36:50 +02:00
2026-05-04 14:36:50 +02:00
2026-05-04 14:36:50 +02:00
2026-05-04 14:36:50 +02:00
2026-05-04 14:57:54 +02:00
2026-05-04 14:57:54 +02:00
2026-05-04 17:03:58 +02:00
2026-05-04 17:03:58 +02:00
2026-05-04 17:03:58 +02:00
2026-05-04 17:03:58 +02:00
2026-05-05 00:05:12 +02:00
2026-05-05 00:05:12 +02:00
2026-05-05 00:05:12 +02:00
2026-05-05 00:05:12 +02:00
2026-05-05 00:05:12 +02:00
2026-05-05 00:05:12 +02:00
2026-05-05 00:05:12 +02:00
2026-05-05 00:05:12 +02:00
2026-05-05 01:25:03 +02:00
2026-05-05 01:25:03 +02:00
2026-05-05 01:49:01 +02:00
2026-05-05 01:49:01 +02:00
2026-05-05 02:19:37 +02:00
2026-05-05 02:19:37 +02:00
2026-05-05 02:48:31 +02:00
2026-05-05 02:48:31 +02:00
2026-05-05 03:17:46 +02:00
2026-05-05 03:17:46 +02:00
2026-05-05 03:46:45 +02:00
2026-05-05 03:46:45 +02:00
2026-05-05 04:32:50 +02:00
2026-05-05 04:32:50 +02:00
2026-05-05 11:18:38 +02:00
2026-05-05 11:18:38 +02:00
2026-05-05 11:18:38 +02:00
2026-05-05 11:22:14 +02:00
2026-05-05 11:18:38 +02:00
2026-05-05 11:18:38 +02:00
2026-05-05 11:53:13 +02:00
2026-05-05 11:53:13 +02:00
2026-05-05 13:29:47 +02:00
2026-05-05 13:29:47 +02:00
2026-05-06 12:37:08 +02:00
2026-05-06 12:37:08 +02:00
2026-05-06 15:13:26 +02:00
2026-05-06 15:13:26 +02:00
2026-05-06 16:45:19 +02:00
2026-05-06 16:45:19 +02:00
2026-05-07 12:51:37 +02:00
2026-05-07 12:51:37 +02:00
2026-05-07 20:58:57 +02:00
2026-05-07 20:58:57 +02:00
2026-05-07 21:49:33 +02:00
2026-05-07 21:49:33 +02:00
2026-05-07 22:00:26 +02:00
2026-05-07 22:00:26 +02:00
2026-05-07 22:21:45 +02:00
2026-05-07 22:21:45 +02:00
2026-05-07 22:41:18 +02:00
2026-05-07 22:41:18 +02:00
2026-05-08 02:13:58 +02:00
2026-05-08 02:13:58 +02:00
2026-05-08 16:00:21 +02:00
2026-05-08 16:00:21 +02:00
2026-05-08 16:23:12 +02:00
2026-05-08 16:23:12 +02:00
2026-05-08 16:54:34 +02:00
2026-05-08 16:54:34 +02:00
2026-05-08 17:16:57 +02:00
2026-05-08 17:16:57 +02:00
2026-05-08 17:16:57 +02:00
2026-05-08 17:16:57 +02:00
2026-05-08 19:15:44 +02:00
2026-05-08 19:15:44 +02:00
2026-05-08 19:20:52 +02:00
2026-05-08 19:20:52 +02:00
2026-05-08 19:42:05 +02:00
2026-05-08 19:42:05 +02:00
2026-05-08 20:21:13 +02:00
2026-05-08 20:21:13 +02:00
2026-05-08 21:52:50 +02:00
2026-05-08 21:52:50 +02:00
2026-05-08 22:01:44 +02:00
2026-05-08 22:01:44 +02:00
2026-05-08 22:16:55 +02:00
2026-05-08 22:16:55 +02:00
2026-05-08 23:33:53 +02:00
2026-05-08 23:33:53 +02:00
2026-05-09 15:33:20 +02:00
2026-05-09 15:33:20 +02:00
2026-05-09 16:07:17 +02:00
2026-05-09 16:07:17 +02:00
2026-05-15 00:19:19 +02:00
2026-05-15 00:19:19 +02:00
2026-05-15 00:19:31 +02:00
2026-05-15 00:19:31 +02:00
2026-05-15 00:19:37 +02:00
2026-05-15 00:19:37 +02:00
2026-05-15 00:28:38 +02:00
2026-05-15 00:28:38 +02:00
2026-05-15 00:28:49 +02:00
2026-05-15 00:28:49 +02:00
2026-05-15 00:29:00 +02:00
2026-05-15 00:29:00 +02:00
2026-05-15 00:40:50 +02:00
2026-05-15 00:40:50 +02:00
2026-05-15 00:40:59 +02:00
2026-05-15 00:40:59 +02:00
2026-05-15 01:01:08 +02:00
2026-05-15 01:01:08 +02:00
2026-05-15 01:01:17 +02:00
2026-05-15 01:01:17 +02:00
2026-05-15 01:37:34 +02:00
2026-05-15 01:37:34 +02:00
2026-05-15 01:37:57 +02:00
2026-05-15 01:37:57 +02:00
2026-05-15 17:53:08 +02:00
2026-05-15 17:53:08 +02:00
2026-05-16 01:17:23 +02:00
2026-05-16 01:17:23 +02:00
2026-05-16 01:29:31 +02:00
2026-05-16 01:29:31 +02:00
2026-05-17 12:30:53 +02:00
2026-05-17 12:30:53 +02:00
2026-05-18 11:46:12 +02:00
2026-05-18 11:46:12 +02:00
2026-05-18 12:13:13 +02:00
2026-05-18 12:13:13 +02:00
2026-05-18 15:39:03 +02:00
2026-05-18 15:39:03 +02:00
2026-05-18 15:05:46 +02:00
2026-05-18 17:28:19 +02:00
2026-05-18 17:29:21 +02:00
2026-05-18 17:33:01 +02:00
2026-05-18 17:46:08 +02:00
2026-05-18 17:46:08 +02:00
2026-05-19 12:44:27 +02:00
2026-05-19 12:44:27 +02:00
2026-05-19 12:51:52 +02:00
2026-05-19 12:51:52 +02:00
2026-05-20 09:50:07 +02:00
2026-05-20 09:50:07 +02:00
2026-05-20 09:47:14 +02:00
2026-05-20 09:47:14 +02:00
2026-05-20 09:47:14 +02:00
2026-05-20 09:47:14 +02:00
2026-05-20 09:52:28 +02:00
2026-05-20 09:52:28 +02:00
2026-05-20 13:05:27 +02:00
2026-05-20 13:05:27 +02:00
2026-05-20 13:26:23 +02:00
2026-05-20 13:26:23 +02:00
2026-05-20 13:55:56 +02:00
2026-05-20 13:55:56 +02:00
2026-05-20 14:43:42 +02:00
2026-05-20 14:43:42 +02:00
2026-05-20 14:46:36 +02:00
2026-05-20 14:46:36 +02:00
2026-05-20 14:55:55 +02:00
2026-05-20 14:55:55 +02:00
2026-05-20 14:55:55 +02:00
2026-05-20 14:55:55 +02:00
2026-05-20 15:24:06 +02:00
2026-05-20 15:24:06 +02:00
2026-05-20 15:38:30 +02:00
2026-05-20 15:38:30 +02:00
2026-05-20 15:50:21 +02:00
2026-05-20 15:50:21 +02:00
2026-05-20 19:15:32 +02:00
2026-05-20 19:15:32 +02:00
2026-05-22 15:17:24 +02:00
2026-05-22 15:17:24 +02:00
2026-05-23 00:06:08 +02:00
2026-05-23 00:06:08 +02:00
2026-05-23 02:19:55 +02:00
2026-05-23 02:19:55 +02:00
2026-05-25 13:57:38 +02:00
2026-05-25 13:57:38 +02:00
2026-05-25 14:54:51 +02:00
2026-05-25 14:54:51 +02:00
2026-05-25 15:28:37 +02:00
2026-05-25 15:28:37 +02:00
2026-05-25 15:46:09 +02:00
2026-05-25 15:46:09 +02:00
2026-05-25 15:40:24 +02:00
2026-05-25 16:12:13 +02:00
2026-05-25 15:49:39 +02:00
2026-05-25 15:49:39 +02:00
2026-05-25 15:56:19 +02:00
2026-05-25 15:56:19 +02:00
2026-05-25 16:06:35 +02:00
2026-05-25 16:06:35 +02:00
2026-05-25 16:45:07 +02:00
2026-05-25 16:45:07 +02:00
2026-05-25 17:03:34 +02:00
2026-05-25 17:03:34 +02:00
2026-05-25 16:51:35 +02:00
2026-05-25 16:51:35 +02:00
2026-05-25 17:29:13 +02:00
2026-05-25 17:29:13 +02:00
2026-05-25 17:25:19 +02:00
2026-05-25 17:25:19 +02:00
2026-05-26 15:19:54 +02:00
2026-05-26 15:19:54 +02:00
2026-05-26 13:58:33 +02:00
2026-05-26 13:58:33 +02:00
2026-05-26 15:12:12 +02:00
2026-05-26 15:12:12 +02:00
2026-05-26 15:37:10 +02:00
2026-05-26 15:37:10 +02:00
2026-05-26 15:43:36 +02:00
2026-05-26 15:43:36 +02:00
2026-05-26 17:59:58 +02:00
2026-05-26 17:59:58 +02:00
2026-05-26 19:53:24 +02:00
2026-05-26 20:32:58 +02:00
2026-05-26 17:48:56 +02:00
2026-05-26 17:48:56 +02:00
2026-05-26 19:23:40 +02:00
2026-05-26 19:23:40 +02:00
2026-05-26 19:23:40 +02:00
2026-05-26 19:23:40 +02:00
2026-05-26 19:23:40 +02:00
2026-05-26 19:23:40 +02:00
2026-05-26 20:04:40 +02:00
2026-05-26 20:04:40 +02:00
2026-05-26 20:21:12 +02:00
2026-05-26 20:21:12 +02:00
2026-05-26 20:54:01 +02:00
2026-05-26 20:54:01 +02:00
2026-05-26 21:21:38 +02:00
2026-05-26 21:21:38 +02:00