Skip to content

Commit 8d3f219

Browse files
Add create database scripts.
1 parent 7454bce commit 8d3f219

File tree

4 files changed

+48
-0
lines changed

4 files changed

+48
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
-- Database: farms${ENV}
2+
3+
-- DROP DATABASE "farms${ENV}";
4+
5+
CREATE DATABASE "farms${ENV}"
6+
WITH
7+
OWNER = postgres
8+
TABLESPACE = pg_default
9+
CONNECTION LIMIT = -1;
10+
11+
COMMENT ON DATABASE "farms${ENV}"
12+
IS 'farms${ENV} database containing schemas used by Farmer Access to Risk Management Service.';
13+
14+
GRANT TEMPORARY, CONNECT ON DATABASE "farms${ENV}" TO PUBLIC;
15+
16+
GRANT ALL ON DATABASE "farms${ENV}" TO postgres;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
-- Role: "app_farms"
2+
-- DROP ROLE "app_farms";
3+
4+
CREATE ROLE "app_farms" WITH
5+
LOGIN
6+
NOSUPERUSER
7+
INHERIT
8+
NOCREATEDB
9+
CREATEROLE
10+
NOREPLICATION
11+
PASSWORD '${POSTGRES_ADMIN_PASSWORD}';
12+
13+
ALTER ROLE app_farms SET search_path TO farms;
14+
15+
ALTER USER app_farms set TIMEZONE to 'America/New_York';
16+
17+
COMMENT ON ROLE "app_farms" IS 'Farmer Access to Risk Management Service.';
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CREATE ROLE "app_farms_custodian";
2+
3+
CREATE ROLE "app_farms_rest_proxy";
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
-- SCHEMA: farms
2+
3+
-- DROP SCHEMA "farms" ;
4+
5+
CREATE SCHEMA "farms"
6+
AUTHORIZATION postgres;
7+
8+
GRANT ALL ON SCHEMA "farms" TO "app_farms";
9+
10+
GRANT ALL ON SCHEMA "farms" TO postgres;
11+
12+
ALTER SCHEMA "farms" OWNER TO "app_farms";

0 commit comments

Comments
 (0)