diff options
author | Baitinq <manuelpalenzuelamerino@gmail.com> | 2024-06-05 23:47:13 +0200 |
---|---|---|
committer | Baitinq <manuelpalenzuelamerino@gmail.com> | 2024-06-05 23:47:13 +0200 |
commit | 2a87ed82ecc46b94c4284ad54fd745453d6c79c2 (patch) | |
tree | 8b043ff9844bf952914c76395bbc0000f703f45a | |
parent | payload-processor: take a list of files (diff) | |
download | fs-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
5 files changed, 27 insertions, 12 deletions
diff --git a/supabase/migrations/20240525164227_create_private_schema.sql b/supabase/migrations/20240525164227_create_private_schema.sql deleted file mode 100644 index 2694800..0000000 --- a/supabase/migrations/20240525164227_create_private_schema.sql +++ /dev/null @@ -1 +0,0 @@ -CREATE SCHEMA IF NOT EXISTS private; diff --git a/supabase/migrations/20240525164247_create_file_table.sql b/supabase/migrations/20240525164247_create_file_table.sql deleted file mode 100644 index 738a16e..0000000 --- a/supabase/migrations/20240525164247_create_file_table.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE IF NOT EXISTS private."file" ( - id SERIAL PRIMARY KEY, - user_id UUID NOT NULL, - absolute_path VARCHAR(4096) NOT NULL, - contents TEXT, - timestamp TIMESTAMPTZ NOT NULL -); diff --git a/supabase/migrations/20240528175243_create_api_keys_table.sql b/supabase/migrations/20240528175243_create_api_keys_table.sql deleted file mode 100644 index 5efa946..0000000 --- a/supabase/migrations/20240528175243_create_api_keys_table.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE IF NOT EXISTS private.api_keys ( - id UUID NOT NULL REFERENCES auth.users, - api_key CHAR(44) NOT NULL -); 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()); diff --git a/supabase/migrations/20240605214222_create_api_key_table.sql b/supabase/migrations/20240605214222_create_api_key_table.sql new file mode 100644 index 0000000..ece2226 --- /dev/null +++ b/supabase/migrations/20240605214222_create_api_key_table.sql @@ -0,0 +1,12 @@ +CREATE TABLE IF NOT EXISTS public."api_key" ( + user_id UUID NOT NULL REFERENCES auth.users, + api_key CHAR(44) NOT NULL +); + +ALTER TABLE public."api_key" ENABLE ROW LEVEL SECURITY; + +CREATE POLICY "Restrict access to user api keys to their own api keys" + ON public."api_key" + FOR SELECT + TO authenticated + USING (user_id = auth.uid()); |