fix(db): seed staff_id FK fix (GRO-369)

Fixes staff_id FK violation on re-seed: move TRUNCATE before staff upsert and add id to onConflictDoUpdate set clause.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit was merged in pull request #199.
This commit is contained in:
groombook-engineer[bot]
2026-04-01 14:19:49 +00:00
committed by GitHub
parent 07263a89fe
commit dff11d02be
6 changed files with 2102 additions and 26 deletions
@@ -0,0 +1,7 @@
-- Clean up existing duplicate services before adding unique constraint.
-- Keep the row with the lowest id per name; delete all others.
DELETE FROM services WHERE id NOT IN (
SELECT (MIN(id::text))::uuid FROM services GROUP BY name
);
ALTER TABLE "services" ADD CONSTRAINT "services_name_unique" UNIQUE("name");
File diff suppressed because it is too large Load Diff
@@ -141,6 +141,13 @@
"when": 1774729055924,
"tag": "0019_concerned_sunfire",
"breakpoints": true
},
{
"idx": 20,
"version": "7",
"when": 1775050467192,
"tag": "0020_typical_daimon_hellstrom",
"breakpoints": true
}
]
}