RelationalDesign: V5__add_test_data.sql

File V5__add_test_data.sql, 7.5 KB (added by 225144, 37 hours 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, user_id)
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, parent_id)
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, parent_id)
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--
59-- INSERT INTO blacklisted_user (topic_id, user_id, moderator_id, start_date, end_date, reason)
60-- VALUES
61-- (1, 2, 1, NOW(), NOW() + INTERVAL '7 days', 'Spamming'),
62-- (2, 3, 2, NOW(), NOW() + INTERVAL '3 days', 'Offensive language');
63
64INSERT INTO permissions (name)
65VALUES
66 ('READ'),
67 ('WRITE'),
68 ('CREATE'),
69 ('DELETE');
70
71INSERT INTO project_role (name, project_id,override_type)
72VALUES
73 ('Admin', 5,'EXCLUDE'),
74 ('Developer', 5,'INCLUDE');
75
76
77INSERT INTO users_project_roles (user_id, role_id)
78VALUES
79 (3, 1),
80 (5, 2);
81
82INSERT INTO role_permissions (permission_name, role_id)
83VALUES
84 ('READ', 1),
85 ('WRITE', 1),
86 ('CREATE',1),
87 ('DELETE',1);
88
89insert into submission(created_by,status,description)
90values
91 (1,'PENDING','Inappropriate content'),
92 (3,'DENIED','Spam content');
93
94INSERT INTO report (id,thread_id, for_user_id)
95VALUES
96 (1, 2, 1),
97 (2, 1, 3);
98
99
100INSERT INTO channel (name, description, project_id, developer_id)
101VALUES
102 ('Updates', 'Project updates channel', 5, 3);
103
104INSERT INTO messages (sent_at, content, sent_by, project_id, channel_name)
105VALUES
106 (NOW(), 'Zdravo. Ova e real-time chat za dopisuvanje', 3, 5, 'General'),
107 (NOW(), 'Resen ladno a?', 3, 5, 'Updates');
108
109---------------- NOV TEST DATA
110
111-- Add new users
112INSERT INTO users (username, is_activate, password, description, registered_at, sex, name, email)
113VALUES
114 -- Password: user6pass
115 ('user6', true, '$2a$12$jB9g/.KP95fsYYOTy0pwZ.kFrwA/G2cMvPvFLzGtCk8jJ2qO3O.3u', 'Sixth user', NOW(), 'M', 'marko', 'marko@gmail.com'),
116 -- Password: user7pass
117 ('user7', true, '$2a$12$KRxRufuMscrlQOLKGw4fBehNLWaP7Zu.M964G2JedKVM4o4wTiJaG', 'Seventh user', NOW(), 'F', 'jana', 'jana@gmail.com'),
118 -- Password: user8pass
119 ('user8', true, '$2a$12$SCqlK.Rl72tFT0kIUNP6KuSy6BYzfdb9sKJPSWbIK8/uk7y8U7hgS', 'Eighth user', NOW(), 'M', 'nikola', 'nikola@gmail.com'),
120 -- Password: user9pass
121 ('user9', true, '$2a$12$LpDTYNb/i0cohkmszkx93ef9rkgFTNFQz/KqHEYIAE9MPOmlyXJ9m', 'Ninth user', NOW(), 'F', 'elena', 'elena@gmail.com'),
122 -- Password: user10pass
123 ('user10', true, '$2a$12$p/kZdDKCUCmXjWTsknss/.UaD4a8vxrTcfvc6mdkpHRRPqRZLLtr6', 'Tenth user', NOW(), 'M', 'petar', 'petar@gmail.com');
124
125-- Add new developers
126INSERT INTO developer (id)
127VALUES
128 (6), -- user6
129 (7), -- user7
130 (8), -- user8
131 (9), -- user9
132 (10); -- user10
133
134-- Add new threads
135INSERT INTO thread (content, user_id)
136VALUES
137 ('Main content for topic thread 3', 6), --10
138 ('Main content for topic thread 4', 7), --11
139 ('Discussion content for topic 3', 6), --12
140 ('Discussion content for topic 4', 7), --13
141 ('Project-specific thread content 3', 8), --14
142 ('Reply to topic 3', 9), --15
143 ('Further discussion on topic 4', 10), --16
144 ('Main content for topic thread 5', 6), --17
145 ('Project-specific thread content 4', 10); --18
146
147-- Add embeddable_thread entries for topic and discussion threads
148INSERT INTO embeddable_thread (id)
149VALUES
150 (10), (11), (12), (13), (15), (16), (17);
151
152-- Add new project_threads
153INSERT INTO project_thread (id, title, repo_url)
154VALUES
155 (14, 'Project 3 Thread', 'http://github.com/project3'),
156 (18, 'Project 4 Thread', 'http://github.com/project4');
157
158-- Add new topic_threads
159INSERT INTO topic_thread (id, title, parent_id)
160VALUES
161 (10, 'Topic 3', 14),
162 (11, 'Topic 4', NULL),
163 (17, 'Topic 8', NULL);
164
165-- Add new topic_guidelines
166INSERT INTO topic_guidelines (topic_id, description)
167VALUES
168 (10, 'Stay on topic'),
169 (11, 'No personal attacks');
170
171-- Add new discussion_threads
172INSERT INTO discussion_thread (id, parent_id)
173VALUES
174 (12, 10),
175 (13, 11),
176 (15, 10),
177 (16, 13);
178
179-- Add new likes
180INSERT INTO likes (user_id, thread_id)
181VALUES
182 (6, 12),
183 (7, 13),
184 (8, 14),
185 (9, 15),
186 (10, 16);
187
188-- Add new blacklisted_user entries
189INSERT INTO blacklisted_user (topic_id, user_id, moderator_id, start_date, end_date, reason)
190VALUES
191 (10, 7, 6, NOW(), NOW() + INTERVAL '5 days', 'Repeated off-topic posts'),
192 (11, 8, 7, NOW(), NOW() + INTERVAL '10 days', 'Harassment');
193
194-- Add new submissions
195INSERT INTO submission (created_by, status, description)
196VALUES
197 (6, 'PENDING', 'Request for new feature'),
198 (7, 'ACCEPTED', 'Bug report');
199
200-- Add new reports
201INSERT INTO report (id, thread_id, for_user_id)
202VALUES
203 (3, 10, 7),
204 (4, 11, 8);
205
206-- Associate developers with projects
207INSERT INTO developer_associated_with_project (project_id, developer_id, started_at)
208VALUES
209 (14, 6, NOW()), -- user6 associated with Project 3
210 (14, 7, NOW()), -- user7 associated with Project 3
211 (18, 8, NOW()), -- user8 associated with Project 4
212 (18, 9, NOW()); -- user9 associated with Project 4
213
214-- Add new channels
215INSERT INTO channel (name, description, project_id, developer_id)
216VALUES
217 ('General2', 'General discussion', 14, 6), -- Created by user6 for Project 3
218 ('Bugs', 'Bug reports and fixes', 14, 7), -- Created by user7 for Project 3
219 ('General2', 'General discussion', 18, 8), -- Created by user8 for Project 4
220 ('Ideas', 'Feature ideas', 18, 9); -- Created by user9 for Project 4
221
222-- Add new messages (only users associated with the project can send messages)
223INSERT INTO messages (sent_at, content, sent_by, project_id, channel_name)
224VALUES
225 (NOW(), 'Welcome to Project 3!', 6, 14, 'General'), -- Sent by user6 in Project 3
226 (NOW(), 'Found a bug in the login module.', 7, 14, 'Bugs'), -- Sent by user7 in Project 3
227 (NOW(), 'Let’s discuss new features.', 8, 18, 'General'), -- Sent by user8 in Project 4
228 (NOW(), 'I have an idea for a new feature.', 9, 18, 'Ideas'); -- Sent by user9 in Project 4
229
230
231
232
233
234
235
236