Skip to content

Commit

Permalink
only create role if it doesn't already exist
Browse files Browse the repository at this point in the history
  • Loading branch information
ob6160 committed Sep 21, 2024
1 parent 3f28106 commit bca22ef
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion supabase/migrations/20240816164300_initial_database_setup.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
-- Create a limited service role for toilet map.
-- Give the role login privileges.
CREATE ROLE toiletmap_web WITH LOGIN;

DO
$$
BEGIN
IF NOT EXISTS (SELECT FROM pg_catalog.pg_roles WHERE rolname = 'toiletmap_web') THEN
CREATE ROLE toiletmap_web WITH LOGIN;
END IF;
END
$$;

ALTER ROLE toiletmap_web WITH PASSWORD 'toiletmap_web';
ALTER ROLE toiletmap_web SET search_path = "\$user", public, extensions, audit;

Expand Down

0 comments on commit bca22ef

Please sign in to comment.