RelationalDesign: V6__add_test_data.sql

File V6__add_test_data.sql, 5.9 KB (added by 226026, 3 weeks ago)
Line 
1INSERT INTO users (username, is_activate, password, description, registered_at, sex, name, email)
2VALUES
3 ('user1', true, '$2a$12$0f.x7aBM2wFBZBXoLPj0BObVsk.J1kXFYo5nb4niAWkI4hk5tHvDy', 'First user', NOW(), 'M','viki', 'viki@gmail.com'),
4 ('user2', true, '$2a$12$VkR0a47LDVM6aUqFcEJGSu9jhZCz.05tCoyiRicFObt4f2x2gijKa', 'Second user', NOW(), 'F','stefan', 'stefan@gmail.com'),
5 ('user3', true, '$2a$12$eSLdHHJ1KFgv.dOupmloXeItjrt2o1IB6ER6Nq7WYj9Jfr2bEwK2a', 'Third user', NOW(), 'M','darko', 'darko@gmail.com'),
6 ('user4', true, '$2a$12$dF5SXcNhMulgU3Qre3nh1e.aatRiJZsnfoBSqReGnXe9rIbHYVWhe', 'Fourth user', NOW(), 'F','andrej', 'andrej@gmail.com'),
7 ('user5', true, '$2a$12$zHrloz8WG2zo5S6MTf1C0ez1raMlmDJdB8OOa2I1S2pVy9oI76YTa', 'Fifth user', NOW(), 'M','ramche', 'ramche@gmail.com');
8
9
10INSERT INTO thread (content, is_created_by)
11VALUES
12 ('Main content for topic thread 1', 1), --1
13 ('Main content for topic thread 2', 2), --2
14 ('Discussion content for topic 1', 1), --3
15 ('Discussion content for topic 2', 2), --4
16 ('Project-specific thread content', 3), --5
17 ('Reply to topic 1', 4), -- 6
18 ('Further discussion on topic 2', 5), --7
19 ('Main content for topic thread', 1), --8
20 ('Project-specific thread content 2', 5); --9
21
22insert into embeddable_thread(id)
23values (1),(2),(3),(4),(6),(7),(8);
24
25
26INSERT INTO project_thread (id, title, repo_url)
27VALUES
28 (5, 'Project 1 Thread', 'http://github.com/project1'),
29 (9, 'Project 2 Thread', 'http://github.com/project1');
30
31INSERT INTO topic_thread (id, title, referenced_by)
32VALUES
33 (1, 'Topic 1' , 5),
34 (2, 'Topic 2', NULL),
35 (8, 'Topic 7' , NULL);
36
37insert into topic_guidelines(topic_id,description)
38values
39 (1,'Follow guidelines'),
40 (2,'Be respectful');
41
42INSERT INTO discussion_thread (id, contained_in)
43VALUES
44 (3, 1),
45 (4, 2),
46 (6, 1),
47 (7, 4);
48
49
50INSERT INTO likes (user_id, thread_id)
51VALUES
52 (1, 3),
53 (2, 4),
54 (3, 5),
55 (4, 6),
56 (5, 7);
57
58-- blacklisted_user matches DDL, so skipped for now
59
60INSERT INTO permissions (name)
61VALUES
62 ('READ'),
63 ('WRITE'),
64 ('CREATE'),
65 ('DELETE');
66
67INSERT INTO project_role (name, valid_in, override_type)
68VALUES
69 ('Admin', 5,'EXCLUDE'),
70 ('Developer', 5,'INCLUDE');
71
72
73INSERT INTO project_role_is_assigned_to_developer (user_id, role_id)
74VALUES
75 (3, 1),
76 (5, 2);
77
78INSERT INTO role_permissions (for_permission, for_role)
79VALUES
80 ('READ', 1),
81 ('WRITE', 1),
82 ('CREATE', 1),
83 ('DELETE', 1);
84
85insert into submission(submitted_by, status, description)
86values
87 (1,'PENDING','Inappropriate content'),
88 (3,'DENIED','Spam content');
89
90INSERT INTO report (id, for_misconduct_in, about)
91VALUES
92 (1, 2, 1),
93 (2, 1, 3);
94
95
96INSERT INTO channel (name, description, project_has, constructed_by)
97VALUES
98 ('Updates', 'Project updates channel', 5, 3);
99
100
101---------------- NOV TEST DATA
102
103-- Add new users (already correct)
104INSERT INTO users (username, is_activate, password, description, registered_at, sex, name, email)
105VALUES
106 ('user6', true, '$2a$12$jB9g/.KP95fsYYOTy0pwZ.kFrwA/G2cMvPvFLzGtCk8jJ2qO3O.3u', 'Sixth user', NOW(), 'M', 'marko', 'marko@gmail.com'),
107 ('user7', true, '$2a$12$KRxRufuMscrlQOLKGw4fBehNLWaP7Zu.M964G2JedKVM4o4wTiJaG', 'Seventh user', NOW(), 'F', 'jana', 'jana@gmail.com'),
108 ('user8', true, '$2a$12$SCqlK.Rl72tFT0kIUNP6KuSy6BYzfdb9sKJPSWbIK8/uk7y8U7hgS', 'Eighth user', NOW(), 'M', 'nikola', 'nikola@gmail.com'),
109 ('user9', true, '$2a$12$LpDTYNb/i0cohkmszkx93ef9rkgFTNFQz/KqHEYIAE9MPOmlyXJ9m', 'Ninth user', NOW(), 'F', 'elena', 'elena@gmail.com'),
110 ('user10', true, '$2a$12$p/kZdDKCUCmXjWTsknss/.UaD4a8vxrTcfvc6mdkpHRRPqRZLLtr6', 'Tenth user', NOW(), 'M', 'petar', 'petar@gmail.com');
111
112-- Add new developers (matches DDL)
113INSERT INTO developer (id)
114VALUES (6),(7),(8),(9),(10);
115
116-- Add new threads
117INSERT INTO thread (content, is_created_by)
118VALUES
119 ('Main content for topic thread 3', 6), --10
120 ('Main content for topic thread 4', 7), --11
121 ('Discussion content for topic 3', 6), --12
122 ('Discussion content for topic 4', 7), --13
123 ('Project-specific thread content 3', 8), --14
124 ('Reply to topic 3', 9), --15
125 ('Further discussion on topic 4', 10), --16
126 ('Main content for topic thread 5', 6), --17
127 ('Project-specific thread content 4', 10); --18
128
129-- Add embeddable_thread entries
130INSERT INTO embeddable_thread (id)
131VALUES (10),(11),(12),(13),(15),(16),(17);
132
133-- New project_threads (matches DDL)
134INSERT INTO project_thread (id, title, repo_url)
135VALUES
136 (14, 'Project 3 Thread', 'http://github.com/project3'),
137 (18, 'Project 4 Thread', 'http://github.com/project4');
138
139-- New topic_threads
140INSERT INTO topic_thread (id, title, referenced_by)
141VALUES
142 (10, 'Topic 3', 14),
143 (11, 'Topic 4', NULL),
144 (17, 'Topic 8', NULL);
145
146-- Guidelines
147INSERT INTO topic_guidelines (topic_id, description)
148VALUES
149 (10, 'Stay on topic'),
150 (11, 'No personal attacks');
151
152-- New discussion_threads
153INSERT INTO discussion_thread (id, contained_in)
154VALUES
155 (12, 10),
156 (13, 11),
157 (15, 10),
158 (16, 13);
159
160-- Likes (matches DDL)
161INSERT INTO likes (user_id, thread_id)
162VALUES
163 (6, 12),
164 (7, 13),
165 (8, 14),
166 (9, 15),
167 (10, 16);
168
169-- blacklisted_user (already matches DDL)
170
171-- New submissions
172INSERT INTO submission (submitted_by, status, description)
173VALUES
174 (6, 'PENDING', 'Request for new feature'),
175 (7, 'ACCEPTED', 'Bug report');
176
177-- Reports
178INSERT INTO report (id, for_misconduct_in, about)
179VALUES
180 (3, 10, 7),
181 (4, 11, 8);
182
183-- Associate developers with projects
184INSERT INTO developer_associated_with_project (in_project, about_dev, started_at)
185VALUES
186 (14, 6, NOW()),
187 (14, 7, NOW()),
188 (18, 8, NOW()),
189 (18, 9, NOW());
190
191-- Channels
192INSERT INTO channel (name, description, project_has, constructed_by)
193VALUES
194 ('General2', 'General discussion', 14, 6),
195 ('Bugs', 'Bug reports and fixes', 14, 7),
196 ('General2', 'General discussion', 18, 8),
197 ('Ideas', 'Feature ideas', 18, 9);