-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0100-020 DB SETUP - CREATE ROLE pccdev.sql
51 lines (44 loc) · 1.37 KB
/
0100-020 DB SETUP - CREATE ROLE pccdev.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
-- AUTHOR: Eric MIlgram, PhD
--
-- DATE: 09 Dec 2021
--
-- PURPOSE
-- The purpose of these SQL statements is to create the pccdev ROLE
-- for the PostgreSQL database used for the Paylocity Coding Challenge.
--
-- ############################################################################
-- Create the 'dev' schema, which is for DB development only
-- ############################################################################
-- ############################################################################
-- CREATE pccdev ROLE, then GRANT the ROLE permission to connect to the DB.
-- ############################################################################
CREATE ROLE pccdev;
GRANT CONNECT
ON DATABASE paylocity
TO pccdev;
-- ############################################################################
-- GRANT the pccdev ROLE the necessary permissions for
-- using the 'dev' SCHEMA.
-- ############################################################################
GRANT USAGE, CREATE
ON SCHEMA dev
TO pccdev;
GRANT
ALL PRIVILEGES
ON ALL TABLES
IN SCHEMA dev
TO pccdev;
ALTER DEFAULT PRIVILEGES
IN SCHEMA dev
GRANT ALL PRIVILEGES
ON TABLES
TO pccdev;
GRANT USAGE
ON ALL SEQUENCES
IN SCHEMA dev
TO pccdev;
ALTER DEFAULT PRIVILEGES
IN SCHEMA dev
GRANT USAGE
ON SEQUENCES
TO pccdev;