about summary refs log tree commit diff
path: root/supabase/migrations/20240605214214_create_file_table.sql
diff options
context:
space:
mode:
authorBaitinq <manuelpalenzuelamerino@gmail.com>2024-06-05 23:47:13 +0200
committerBaitinq <manuelpalenzuelamerino@gmail.com>2024-06-05 23:47:13 +0200
commit2a87ed82ecc46b94c4284ad54fd745453d6c79c2 (patch)
tree8b043ff9844bf952914c76395bbc0000f703f45a /supabase/migrations/20240605214214_create_file_table.sql
parentpayload-processor: take a list of files (diff)
downloadfs-tracer-backend-2a87ed82ecc46b94c4284ad54fd745453d6c79c2.tar.gz
fs-tracer-backend-2a87ed82ecc46b94c4284ad54fd745453d6c79c2.tar.bz2
fs-tracer-backend-2a87ed82ecc46b94c4284ad54fd745453d6c79c2.zip
Supabase: Migrations: Update migrations to add table to public schema and add RLS
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());