-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy path06_topics.sql
More file actions
38 lines (32 loc) · 1.2 KB
/
06_topics.sql
File metadata and controls
38 lines (32 loc) · 1.2 KB
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
--liquibase formatted sql
--changeset emilius:06-topics-1
DROP TABLE topic_reviewers;
CREATE TABLE topic_roles
(
topic_id UUID NOT NULL,
user_id UUID NOT NULL,
role TEXT NOT NULL,
assigned_at TIMESTAMP NOT NULL,
assigned_by UUID NOT NULL,
PRIMARY KEY (topic_id, user_id, role),
FOREIGN KEY (topic_id) REFERENCES topics (topic_id),
FOREIGN KEY (user_id) REFERENCES users (user_id),
FOREIGN KEY (assigned_by) REFERENCES users (user_id)
);
--changeset emilius:06-topics-2
ALTER TABLE topics ALTER COLUMN required_degree DROP NOT NULL;
--changeset emilius:06-topics-3
ALTER TABLE topics ADD COLUMN type TEXT;
--changeset emilius:06-topics-4
ALTER TABLE topics DROP COLUMN required_degree;
ALTER TABLE users DROP COLUMN research_areas;
ALTER TABLE users DROP COLUMN focus_topics;
--changeset emilius:06-topics-5
UPDATE applications SET comment = '' WHERE comment IS NULL;
ALTER TABLE applications
ALTER COLUMN comment SET DEFAULT '',
ALTER COLUMN comment SET NOT NULL;
--changeset emilius:06-topics-6
ALTER TABLE topics ADD COLUMN thesis_types TEXT[];
ALTER TABLE topics DROP COLUMN "type";
ALTER TABLE applications ADD COLUMN thesis_type TEXT;