RelationalDesign: test-data.sql

File test-data.sql, 3.1 KB (added by 225144, 2 weeks ago)
Line 
1INSERT INTO users (username, is_activate, password, description, registered_at, sex)
2VALUES
3 ('user1', true, 'password1', 'First user', NOW(), 'M'),
4 ('user2', true, 'password2', 'Second user', NOW(), 'F'),
5 ('user3', true, 'password3', 'Third user', NOW(), 'M'),
6 ('user4', true, 'password4', 'Fourth user', NOW(), 'F'),
7 ('user5', true, 'password5', 'Fifth user', NOW(), 'M');
8
9INSERT INTO thread (content, user_id)
10VALUES
11 ('Main content for topic thread 1', 1),
12 ('Main content for topic thread 2', 2),
13 ('Discussion content for topic 1', 1),
14 ('Discussion content for topic 2', 2),
15 ('Project-specific thread content', 3),
16 ('Reply to topic 1', 4),
17 ('Further discussion on topic 2', 5);
18
19INSERT INTO topic_thread (id, title, guidelines, parent_id)
20VALUES
21 (1, 'Topic 1', '{"rule1": "Follow guidelines"}', NULL),
22 (2, 'Topic 2', '{"rule2": "Be respectful"}', NULL);
23
24INSERT INTO discussion_thread (id, parent_id)
25VALUES
26 (3, 1),
27 (4, 2),
28 (6, 3),
29 (7, 4);
30
31INSERT INTO project_thread (id, title, repo_url)
32VALUES
33 (5, 'Project 1 Thread', 'http://github.com/project1');
34
35INSERT INTO likes (user_id, thread_id)
36VALUES
37 (1, 3),
38 (2, 4),
39 (3, 5),
40 (4, 6),
41 (5, 7);
42
43INSERT INTO tag (name)
44VALUES
45 ('Tag1'),
46 ('Tag2'),
47 ('Tag3');
48
49INSERT INTO tag_threads (thread_id, tag_name)
50VALUES
51 (1, 'Tag1'),
52 (3, 'Tag2'),
53 (5, 'Tag3'),
54 (6, 'Tag1');
55
56INSERT INTO topic_belongs_to_project (topic_id, project_id)
57VALUES
58 (1, 5),
59 (2, 5);
60
61INSERT INTO blacklisted_user (topic_id, user_id, moderator_id, start_date, end_date, reason)
62VALUES
63 (1, 2, 1, NOW(), NOW() + INTERVAL '7 days', 'Spamming'),
64 (2, 3, 4, NOW(), NOW() + INTERVAL '3 days', 'Offensive language');
65
66INSERT INTO developer_associated_with_project (project_id, developer_id, started_at)
67VALUES
68 (5, 2, NOW()),
69 (5, 3, NOW());
70
71INSERT INTO permissions (name)
72VALUES
73 ('Create Thread'),
74 ('Delete Thread');
75
76INSERT INTO project_roles (name, project_id, description)
77VALUES
78 ('Admin', 5, 'Admin role for the project'),
79 ('Developer', 5, 'Developer role for the project');
80
81INSERT INTO users_project_roles (user_id, project_id, role_name)
82VALUES
83 (3, 5, 'Admin'),
84 (2, 5, 'Developer'),
85 (4, 5, 'Developer');
86
87INSERT INTO project_roles_permissions (permission_name, role_name, project_id)
88VALUES
89 ('Create Thread', 'Admin', 5),
90 ('Delete Thread', 'Admin', 5);
91
92INSERT INTO project_request (description, status, user_id, project_id)
93VALUES
94 ('Request to join Project 1', 'PENDING', 2, 5),
95 ('Request to join Project 1', 'ACCEPTED', 4, 5);
96
97INSERT INTO report (created_at, description, status, thread_id, for_user_id, by_user_id)
98VALUES
99 (NOW(), 'Inappropriate content', 'PENDING', 3, 2, 1),
100 (NOW(), 'Spam content', 'DENIED', 6, 4, 3);
101
102INSERT INTO channel (name, description, project_id, developer_id)
103VALUES
104 ('General', 'General discussion channel', 5, 2),
105 ('Updates', 'Project updates channel', 5, 3);
106
107INSERT INTO messages (sent_at, content, sent_by, project_id, channel_name)
108VALUES
109 (NOW(), 'Hello, team!', 2, 5, 'General'),
110 (NOW(), 'We need to push the deadline.', 3, 5, 'Updates');