From c886f910b103bfa22bc72943a0bf95b293c32c70 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Tue, 22 May 2018 14:30:08 -0400 Subject: [PATCH] include file to setup dev envrionment --- deploy/setup_dev.sql | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 deploy/setup_dev.sql diff --git a/deploy/setup_dev.sql b/deploy/setup_dev.sql new file mode 100644 index 0000000..b92dad4 --- /dev/null +++ b/deploy/setup_dev.sql @@ -0,0 +1,28 @@ +------create dev schema and api user----------------------------------------------------------------------------------------------------------------- + +DROP SCHEMA IF EXISTS tps_dev; + +CREATE SCHEMA tps_dev; + +DROP USER IF EXISTS api_dev; + +CREATE USER api_dev WITH + LOGIN + NOSUPERUSER + NOCREATEDB + NOCREATEROLE + INHERIT + NOREPLICATION + CONNECTION LIMIT -1 + PASSWORD 'api_dev'; + +-----need to setup all database objects and then grant priveledges to api---------------------------------------------------------------------------- + +GRANT SELECT, UPDATE, INSERT, DELETE ON ALL TABLES IN SCHEMA tps_dev TO api_dev; + +GRANT USAGE ON ALL SEQUENCES IN SCHEMA tps_dev TO api_dev; + +ALTER DEFAULT PRIVILEGES IN SCHEMA tps_dev GRANT SELECT, UPDATE, INSERT, DELETE ON TABLES TO api_dev; + +ALTER DEFAULT PRIVILEGES IN SCHEMA tps_dev GRANT USAGE ON SEQUENCES TO api_dev; +