RelationalDesign: V2__add_test_data.2.sql

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