Skip to content

Commit

Permalink
Improve
Browse files Browse the repository at this point in the history
  • Loading branch information
stevschmid committed Mar 26, 2024
1 parent bb34254 commit 0893779
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/tasks/rls.rake
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ namespace :rls do
RLS.connection.execute <<~SQL
DO $$
BEGIN
CREATE ROLE "#{RLS.role}" WITH NOLOGIN;
EXCEPTION
WHEN DUPLICATE_OBJECT THEN
IF NOT EXISTS (SELECT 1 FROM pg_roles WHERE rolname = '#{RLS.role}') THEN
CREATE ROLE "#{RLS.role}" WITH NOLOGIN;
RAISE NOTICE 'Role "#{RLS.role}" created';
ELSE
RAISE NOTICE 'Role "#{RLS.role}" already exists';
END IF;
END
$$;
Expand Down

0 comments on commit 0893779

Please sign in to comment.