Skip to content

Commit 9251ef3

Browse files
committed
winning submission from the challenge 30093850 - Topcoder Project Service - Workstreams
1 parent 439fb06 commit 9251ef3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+6974
-36
lines changed

migrations/20190624_workStream.sql

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
--
2+
-- CREATE NEW TABLE:
3+
-- work_streams
4+
--
5+
CREATE TABLE work_streams (
6+
id bigint NOT NULL,
7+
"name" character varying(255) NOT NULL,
8+
"type" character varying(45) NOT NULL,
9+
"status" character varying(255) NOT NULL,
10+
"projectId" bigint NOT NULL,
11+
"deletedAt" timestamp with time zone,
12+
"createdAt" timestamp with time zone,
13+
"updatedAt" timestamp with time zone,
14+
"deletedBy" bigint,
15+
"createdBy" bigint NOT NULL,
16+
"updatedBy" bigint NOT NULL
17+
);
18+
19+
CREATE SEQUENCE work_streams_id_seq
20+
START WITH 1
21+
INCREMENT BY 1
22+
NO MINVALUE
23+
NO MAXVALUE
24+
CACHE 1;
25+
26+
ALTER SEQUENCE work_streams_id_seq OWNED BY work_streams.id;
27+
28+
ALTER TABLE work_streams
29+
ALTER COLUMN id SET DEFAULT nextval('work_streams_id_seq');
30+
31+
ALTER TABLE ONLY work_streams
32+
ADD CONSTRAINT "work_streams_pkey" PRIMARY KEY (id);
33+
34+
ALTER TABLE ONLY work_streams
35+
ADD CONSTRAINT "work_streams_projectId_fkey" FOREIGN KEY ("projectId") REFERENCES projects(id) ON UPDATE CASCADE ON DELETE SET NULL;
36+
37+
--
38+
-- CREATE NEW TABLE:
39+
-- work_management_permissions
40+
--
41+
CREATE TABLE work_management_permissions (
42+
id bigint NOT NULL,
43+
"policy" character varying(255) NOT NULL,
44+
"allowRule" json,
45+
"denyRule" json,
46+
"projectTemplateId" bigint NOT NULL,
47+
"deletedAt" timestamp with time zone,
48+
"createdAt" timestamp with time zone,
49+
"updatedAt" timestamp with time zone,
50+
"deletedBy" bigint,
51+
"createdBy" bigint NOT NULL,
52+
"updatedBy" bigint NOT NULL
53+
);
54+
55+
CREATE SEQUENCE work_management_permissions_id_seq
56+
START WITH 1
57+
INCREMENT BY 1
58+
NO MINVALUE
59+
NO MAXVALUE
60+
CACHE 1;
61+
62+
ALTER SEQUENCE work_management_permissions_id_seq OWNED BY work_management_permissions.id;
63+
64+
ALTER TABLE work_management_permissions
65+
ALTER COLUMN id SET DEFAULT nextval('work_management_permissions_id_seq');
66+
67+
--
68+
-- CREATE NEW TABLE:
69+
-- phase_work_streams
70+
--
71+
CREATE TABLE phase_work_streams (
72+
"workStreamId" bigint NOT NULL,
73+
"phaseId" bigint NOT NULL
74+
);
75+
76+
ALTER TABLE ONLY phase_work_streams
77+
ADD CONSTRAINT "phase_work_streams_pkey" PRIMARY KEY ("workStreamId", "phaseId");
78+
79+
ALTER TABLE ONLY phase_work_streams
80+
ADD CONSTRAINT "phase_work_streams_phaseId_fkey" FOREIGN KEY ("phaseId") REFERENCES project_phases(id) ON UPDATE CASCADE ON DELETE CASCADE;
81+
82+
ALTER TABLE ONLY phase_work_streams
83+
ADD CONSTRAINT "phase_work_streams_workStreamId_fkey" FOREIGN KEY ("workStreamId") REFERENCES work_streams(id) ON UPDATE CASCADE ON DELETE CASCADE;

0 commit comments

Comments
 (0)