Skip to content

Commit e48b1e2

Browse files
Cleaned up the SQL scripts for building the DB schema and tables
1 parent 1a98499 commit e48b1e2

4 files changed

+30
-4
lines changed

code/SQL/0100-010 DB SETUP - CREATE SCHEMA dev and TABLES.sql

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
(
2121
guid uuid PRIMARY KEY,
2222
name varchar(50) NOT NULL UNIQUE,
23-
status integer NOT NULL
23+
status integer NOT NULL,
24+
created timestamp NOT NULL DEFAULT NOW()
2425
);
2526

2627

@@ -31,7 +32,8 @@
3132
(
3233
guid uuid PRIMARY KEY,
3334
name varchar(50) NOT NULL UNIQUE,
34-
status integer NOT NULL
35+
status integer NOT NULL,
36+
created timestamp NOT NULL DEFAULT NOW()
3537
);
3638

3739
-- ############################################################################
@@ -41,7 +43,8 @@
4143
(
4244
guid uuid PRIMARY KEY,
4345
state varchar(50) NOT NULL,
44-
status integer NOT NULL
46+
status integer NOT NULL,
47+
created timestamp NOT NULL DEFAULT NOW()
4548
);
4649

4750
-- ############################################################################
@@ -53,6 +56,7 @@
5356
company_guid uuid NOT NULL,
5457
position_guid uuid NOT NULL,
5558
employee_guid uuid NOT NULL,
59+
created timestamp NOT NULL DEFAULT NOW(),
5660
CONSTRAINT Job_PK PRIMARY KEY (guid),
5761
CONSTRAINT Job_FK_company_guid FOREIGN KEY (company_guid) REFERENCES Company (guid),
5862
CONSTRAINT Job_FK_position_guid FOREIGN KEY (position_guid) REFERENCES Position (guid),

code/SQL/0100-020 DB SETUP - CREATE ROLE pccdev.sql

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
-- AUTHOR: Eric MIlgram, PhD
2+
--
3+
-- DATE: 09 Dec 2021
4+
--
5+
-- PURPOSE
6+
-- The purpose of these SQL statements is to create the pccdev ROLE
7+
-- for the PostgreSQL database used for the Paylocity Coding Challenge.
8+
--
9+
-- ############################################################################
10+
-- Create the 'dev' schema, which is for DB development only
11+
-- ############################################################################
12+
113
-- ############################################################################
214
-- CREATE pccdev ROLE, then GRANT the ROLE permission to connect to the DB.
315
-- ############################################################################

code/SQL/0100-030 DB SETUP - CREATE USER emilgram from ROLE pccdev.sql

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
-- AUTHOR: Eric MIlgram, PhD
2+
--
3+
-- DATE: 09 Dec 2021
4+
--
5+
-- PURPOSE
6+
-- The purpose of these SQL statements is to create a developer user
7+
-- for the PostgreSQL database used for the Paylocity Coding Challenge.
8+
--
9+
-- ############################################################################
10+
-- Create the 'dev' schema, which is for DB development only
11+
-- ############################################################################
112
-- ############################################################################
213
-- Create the first user of the 'dev' schema.
314
-- ############################################################################

code/SQL/0300-000 TESTS - INSERT new records into all 4 dev SCHEMA TABLES.sql

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
-- ############################################################################
1414
SET search_path TO dev;
1515

16-
1716
-- ############################################################################
1817
-- Start the transaction before any inserts and only commit it if all
1918
-- inserts work properly.

0 commit comments

Comments
 (0)