include file to setup dev envrionment

This commit is contained in:
Paul Trowbridge 2018-05-22 14:30:08 -04:00
parent 1342ab44c9
commit c886f910b1

28
deploy/setup_dev.sql Normal file
View File

@ -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;