-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
-- migrate:up | ||
DO | ||
$do$ | ||
BEGIN | ||
IF EXISTS ( | ||
SELECT FROM pg_catalog.pg_roles | ||
WHERE rolname = 'readonly') THEN | ||
|
||
RAISE NOTICE 'Role "readonly" already exists. Skipping.'; | ||
ELSE | ||
create role "readonly" WITH LOGIN password 'readonly'; | ||
END IF; | ||
END | ||
$do$; | ||
|
||
grant connect on database postgres to readonly; | ||
|
||
GRANT USAGE ON SCHEMA public to readonly; | ||
|
||
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readonly; | ||
|
||
GRANT SELECT ON ALL SEQUENCES IN SCHEMA public TO readonly; | ||
|
||
|
||
-- migrate:down | ||
|