fix(structures): align Structure.delegation_code FK action with Prisma default #229

Merged
julien merged 1 commits from fix/adr-0027-pr1-fk-action-on-delete into main 2026-05-26 12:11:14 +02:00

1 Commits

Author SHA1 Message Date
Julien Gautier b625090c63 fix(structures): align Structure.delegation_code FK action with Prisma default
CI / scan (pull_request) Successful in 4m18s
CI / commits (pull_request) Successful in 4m19s
CI / check (pull_request) Failing after 4m32s
CI / a11y (pull_request) Successful in 2m55s
CI / perf (pull_request) Successful in 7m50s
ON DELETE RESTRICT was Prisma's default for required relations;
Structure.delegation is optional (`Delegation?`), so the matching
default is ON DELETE SET NULL. Mismatch caused `prisma migrate dev`
to detect drift and prompt for a corrective migration on every run.

Caught locally on first VM-side validation. No production deployment
of #228 yet, so editing the migration in place rather than shipping a
corrective sibling - keeps the repo's migration history minimal.

Inline comment at the offending line explains the rule (nullable
Prisma relation -> SET NULL) to head off the same mistake when
ADR-0026 PR 1 adds optional FKs (Person.user, User.scopes).
2026-05-26 11:56:47 +02:00