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
ALTERTABLE"categories" ADD CONSTRAINT"categories_created_by_profiles_id_fk"FOREIGN KEY ("created_by") REFERENCES"public"."profiles"("id") ON DELETE restrict ONUPDATE no action;--> statement-breakpoint
37
+
ALTERTABLE"categories" ADD CONSTRAINT"categories_updated_by_profiles_id_fk"FOREIGN KEY ("updated_by") REFERENCES"public"."profiles"("id") ON DELETE restrict ONUPDATE no action;--> statement-breakpoint
38
+
ALTERTABLE"tasks" ADD CONSTRAINT"tasks_category_id_categories_id_fk"FOREIGN KEY ("category_id") REFERENCES"public"."categories"("id") ON DELETE cascadeONUPDATE no action;--> statement-breakpoint
39
+
ALTERTABLE"tasks" ADD CONSTRAINT"tasks_created_by_profiles_id_fk"FOREIGN KEY ("created_by") REFERENCES"public"."profiles"("id") ON DELETE restrict ONUPDATE no action;--> statement-breakpoint
40
+
ALTERTABLE"tasks" ADD CONSTRAINT"tasks_updated_by_profiles_id_fk"FOREIGN KEY ("updated_by") REFERENCES"public"."profiles"("id") ON DELETE restrict ONUPDATE no action;--> statement-breakpoint
41
+
CREATEUNIQUE INDEX "categories_system_name_idx" ON"categories" USING btree ("created_by","name") WHERE"categories"."kind"='system';--> statement-breakpoint
42
+
CREATE POLICY "Users can view their categories"ON"categories"AS PERMISSIVE FOR SELECT TO "authenticated" USING ("categories"."created_by"= (selectauth.uid()));--> statement-breakpoint
43
+
CREATE POLICY "Users can insert categories"ON"categories"AS PERMISSIVE FOR INSERT TO "authenticated" WITH CHECK ("categories"."created_by"= (selectauth.uid()));--> statement-breakpoint
44
+
CREATE POLICY "Users can update their categories"ON"categories"AS PERMISSIVE FOR UPDATE TO "authenticated" USING ("categories"."created_by"= (selectauth.uid())) WITH CHECK ("categories"."created_by"= (selectauth.uid()));--> statement-breakpoint
45
+
CREATE POLICY "Users can delete their categories"ON"categories"AS PERMISSIVE FOR DELETE TO "authenticated" USING ("categories"."created_by"= (selectauth.uid()));--> statement-breakpoint
46
+
CREATE POLICY "Users can view their profile"ON"profiles"AS PERMISSIVE FOR SELECT TO "authenticated" USING ("profiles"."id"= (selectauth.uid()));--> statement-breakpoint
47
+
CREATE POLICY "Users can insert their profile"ON"profiles"AS PERMISSIVE FOR INSERT TO "authenticated" WITH CHECK ("profiles"."id"= (selectauth.uid()));--> statement-breakpoint
48
+
CREATE POLICY "Users can update their profile"ON"profiles"AS PERMISSIVE FOR UPDATE TO "authenticated" USING ("profiles"."id"= (selectauth.uid())) WITH CHECK ("profiles"."id"= (selectauth.uid()));--> statement-breakpoint
49
+
CREATE POLICY "Users can view their tasks"ON"tasks"AS PERMISSIVE FOR SELECT TO "authenticated" USING (
50
+
"tasks"."created_by"= (selectauth.uid())
51
+
OR EXISTS (
52
+
SELECT1
53
+
FROM"categories"
54
+
WHERE"categories"."id"="tasks"."category_id"
55
+
AND"categories"."created_by"= (selectauth.uid())
56
+
)
57
+
);--> statement-breakpoint
58
+
CREATE POLICY "Users can insert tasks in their categories"ON"tasks"AS PERMISSIVE FOR INSERT TO "authenticated" WITH CHECK (
59
+
"tasks"."created_by"= (selectauth.uid())
60
+
OR EXISTS (
61
+
SELECT1
62
+
FROM"categories"
63
+
WHERE"categories"."id"="tasks"."category_id"
64
+
AND"categories"."created_by"= (selectauth.uid())
65
+
)
66
+
);--> statement-breakpoint
67
+
CREATE POLICY "Users can update their tasks"ON"tasks"AS PERMISSIVE FOR UPDATE TO "authenticated" USING (
68
+
"tasks"."created_by"= (selectauth.uid())
69
+
OR EXISTS (
70
+
SELECT1
71
+
FROM"categories"
72
+
WHERE"categories"."id"="tasks"."category_id"
73
+
AND"categories"."created_by"= (selectauth.uid())
74
+
)
75
+
) WITH CHECK (
76
+
"tasks"."created_by"= (selectauth.uid())
77
+
OR EXISTS (
78
+
SELECT1
79
+
FROM"categories"
80
+
WHERE"categories"."id"="tasks"."category_id"
81
+
AND"categories"."created_by"= (selectauth.uid())
82
+
)
83
+
);--> statement-breakpoint
84
+
CREATE POLICY "Users can delete their tasks"ON"tasks"AS PERMISSIVE FOR DELETE TO "authenticated" USING (
0 commit comments