You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -100,8 +108,9 @@ WHERE "permission_group_id" IN (
100
108
101
109
DELETEFROM"permission_group"WHERE"organization_id"IS NOT NULL;--> statement-breakpoint
102
110
103
-
-- 6. Enforce NOT NULL on workspace_id now that every surviving row has one.
111
+
-- 6. Enforce NOT NULL on both workspace_id columns now that every surviving row has one.
104
112
ALTERTABLE"permission_group" ALTER COLUMN "workspace_id"SETNOT NULL;--> statement-breakpoint
113
+
ALTERTABLE"permission_group_member" ALTER COLUMN "workspace_id"SETNOT NULL;--> statement-breakpoint
105
114
106
115
-- 7. Drop legacy structures and swap indexes.
107
116
ALTERTABLE"permission_group" DROP CONSTRAINT"permission_group_organization_id_organization_id_fk";--> statement-breakpoint
@@ -112,6 +121,8 @@ ALTER TABLE "permission_group" DROP COLUMN "organization_id";--> statement-break
112
121
CREATEUNIQUE INDEX "permission_group_workspace_name_unique" ON"permission_group" USING btree ("workspace_id","name");--> statement-breakpoint
113
122
CREATEUNIQUE INDEX "permission_group_workspace_auto_add_unique" ON"permission_group" USING btree ("workspace_id") WHERE auto_add_new_members = true;--> statement-breakpoint
114
123
CREATEUNIQUE INDEX "permission_group_member_group_user_unique" ON"permission_group_member" USING btree ("permission_group_id","user_id");--> statement-breakpoint
124
+
CREATEUNIQUE INDEX "permission_group_member_workspace_user_unique" ON"permission_group_member" USING btree ("workspace_id","user_id");--> statement-breakpoint
115
125
116
126
-- 8. Sweep any residual dead config keys from pre-existing workspace-scoped rows (if any).
0 commit comments