-
Notifications
You must be signed in to change notification settings - Fork 7
/
data.sql
99 lines (93 loc) · 2.78 KB
/
data.sql
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
alter sequence users_id_seq restart;
truncate table users cascade;
copy users (id, username) from stdin delimiter ' ';
1 ringo
2 john
3 paul
4 george
5 yoko
6 brian
7 dwight
8 kevin
9 angela
10 jim
11 michael
12 pam
13 stanley
\.
select setval('users_id_seq', (select max(id) + 1 from users), false);
truncate table users_details cascade;
copy users_details (user_id, email, phone, audience) from stdin delimiter ' ';
1 [email protected] 408-379-4348 public
3 [email protected] 586-773-1545 friends
4 [email protected] 917-803-4806 friends_of_friends
5 [email protected] 571-721-1472 friends
6 [email protected] 724-689-8787 public
7 [email protected] 954-951-8757 friends_blacklist
8 [email protected] 608-864-5863 friends_whitelist
9 [email protected] 408-203-3253 personal
13 [email protected] 972-407-1401 friends_of_friends
\.
truncate table friendships cascade;
copy friendships (source_user_id, target_user_id, status) from stdin delimiter ' ';
1 2 accepted
1 3 accepted
1 4 accepted
2 3 accepted
2 4 accepted
2 5 accepted
3 4 accepted
2 6 accepted
8 7 accepted
7 9 accepted
10 7 accepted
7 11 accepted
7 12 accepted
8 9 accepted
10 8 accepted
11 8 accepted
8 12 accepted
13 8 accepted
\.
copy friendships (source_user_id, target_user_id, status, blockee_id) from stdin delimiter ' ';
6 5 blocked 5
3 5 blocked 5
13 11 blocked 11
\.
truncate table users_details_access cascade;
copy users_details_access (user_details_id, source_user_id, target_user_id, access_type) from stdin delimiter ' ';
8 8 9 whitelist
8 8 12 whitelist
7 10 7 blacklist
13 13 11 blacklist
\.
alter sequence posts_id_seq restart;
truncate table posts cascade;
copy posts (id, creator_id, audience, title, body) from stdin delimiter '|';
1|1|friends|Excluding Yoko|Not for Yoko.
2|1|personal|Only for myself|A post for me.
3|1|public|Hello everybody|A post for everyone.
4|1|friends_whitelist|For some friends|A post for some friends.
5|3|friends_blacklist|For all friends except|A post for all except some friends.
6|6|friends_whitelist|A test for whitelist|Just a test.
7|1|friends_of_friends|Hey!|A post for friends of friends.
8|6|public|Hello|Hello to all except blocked users.
9|13|friends_of_friends|Howdy|Getting tired of this job.
\.
select setval('posts_id_seq', (select max(id) + 1 from posts), false);
truncate table posts_access cascade;
copy posts_access (post_id, creator_id, source_user_id, target_user_id, access_type) from stdin delimiter ' ';
4 1 1 2 whitelist
5 3 1 3 blacklist
6 6 6 5 blacklist
\.
alter sequence comments_id_seq restart;
truncate table comments cascade;
copy comments (post_id, user_id, body) from stdin delimiter '|';
1|2|First comment!
1|3|Second comment!
3|3|Hey all!
3|2|Hello!
3|5|Hi!
\.
select setval('comments_id_seq', (select max(id) + 1 from posts), false);