max / makenotwork
1 file changed,
+5 insertions,
-0 deletions
| @@ -6,5 +6,10 @@ | |||
| 6 | 6 | -- tightening is safe. 006's inline CHECK cannot be edited (applied-migration | |
| 7 | 7 | -- checksum rule), so replace the auto-named constraint here. | |
| 8 | 8 | ALTER TABLE memberships DROP CONSTRAINT IF EXISTS memberships_role_check; | |
| 9 | + | -- Self-heal before tightening: nothing writes 'guest', but if a legacy row from | |
| 10 | + | -- 006's wider CHECK somehow exists, the ADD CONSTRAINT below would hard-fail the | |
| 11 | + | -- whole deploy on it. Fold any such row to 'member' first so the migration is | |
| 12 | + | -- idempotent and can't be blocked by data (fuzz-2026-07-06 migration self-heal). | |
| 13 | + | UPDATE memberships SET role = 'member' WHERE role = 'guest'; | |
| 9 | 14 | ALTER TABLE memberships ADD CONSTRAINT memberships_role_check | |
| 10 | 15 | CHECK (role IN ('owner', 'moderator', 'member')); |