about summary refs log tree commit diff
path: root/supabase/migrations/20240605214214_create_file_table.sql
diff options
context:
space:
mode:
Diffstat (limited to 'supabase/migrations/20240605214214_create_file_table.sql')
-rw-r--r--supabase/migrations/20240605214214_create_file_table.sql15
1 files changed, 15 insertions, 0 deletions
diff --git a/supabase/migrations/20240605214214_create_file_table.sql b/supabase/migrations/20240605214214_create_file_table.sql
new file mode 100644
index 0000000..75b462f
--- /dev/null
+++ b/supabase/migrations/20240605214214_create_file_table.sql
@@ -0,0 +1,15 @@
+CREATE TABLE IF NOT EXISTS public."file" (
+	id SERIAL PRIMARY KEY,
+	user_id UUID NOT NULL,
+	absolute_path VARCHAR(4096) NOT NULL,
+	contents TEXT,
+	timestamp TIMESTAMPTZ NOT NULL
+);
+
+ALTER TABLE public."file" ENABLE ROW LEVEL SECURITY;
+
+CREATE POLICY "Restrict access to user files to their own files"
+	ON public."file"
+	FOR SELECT
+	TO authenticated
+	USING (user_id = auth.uid());