-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdbinit.sql
155 lines (134 loc) · 4.04 KB
/
dbinit.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
drop database if exists xiaoyu;
create database xiaoyu;
use xiaoyu;
create table user (
`uid` INT(10) NOT NULL PRIMARY KEY AUTO_INCREMENT,
`phonenum` varchar(32) not null,
`password` varchar(32) not null,
`permission` tinyint(1),
`online` tinyint(2), # Login status: Online, offline, hide to friends, hide to strangers, hide to all
`created_at` real,
`last_login` real
) engine=innodb default charset=utf8;
create table user_school (
`uid` int(10) not null primary key,
`school_name` text,
`degree` int(9),
`school_id` int(10),
`school_province` int(10),
`school_city` int(10),
`auth_photo` text,
`pass` boolean
) engine=innodb default charset=utf8;
create table user_meta (
`uid` int(10) not null primary key,
`nickname` varchar(32),
`realname` varchar(32),
`gender` tinyint(2),
`age` tinyint(3),
`height` real,
`birthday` real,
`horoscope` tinyint(3),
`hometown_province` int(9),
`hometown_city` int(9),
`hometown_addr` text,
`workplace_province` int(9),
`workplace_city` int(9),
`workplace_addr` text,
`contact` text,
`motto` text,
`show_name` boolean,
`show_contact` boolean
) engine=innodb default charset=utf8;
create table user_ext (
`uid` int(10) not null primary key,
`content` text # JSON key-value data
) engine=innodb default charset=utf8;
create table wall (
`uid` int(10) not null primary key,
`photos` text, # JSON array
`upvotes` int(10),
`filter` text
);
create table photos (
`id` int(10) not null primary key auto_increment,
`user` int(10) not null,
`url` text,
`desc` text,
`created_at` real,
) engine=innodb default charset=utf8;
create table tweets (
`id` int(10) not null primary key auto_increment,
`user` int(10) not null,
`content` text,
`visibility` tinyint(2),
`created_at` real,
) engine=innodb default charset=utf8;
create table replies (
`id` int(10) not null primary key auto_increment,
`user` int(10) not null,
`target` int(10) not null,
`content` text,
`visibility` tinyint(2),
`created_at` real
) engine=innodb default charset=utf8;
create table messages (
`id` int(10) not null primary key auto_increment,
`user` int(10) not null,
`target` int(10) not null,
`content` text,
`visibility` tinyint(2),
`created_at` real
) engine=innodb default charset=utf8;
create table friends (
`id` int(10) not null primary key auto_increment,
`user` int(10) not null,
`to` int(10) not null,
`group` tinyint(2),
`agree` tinyint(2),
) engine=innodb default charset=utf8;
create table friend_group (
`user` int(10) not null primary key,
`content` text # A json array.
) engine=innodb default charset=utf8;
create table blacklist (
`id` int(10) not null primary key auto_increment,
`user` int(10) not null,
`to` int(10) not null
) engine=innodb default charset=utf8;
create table notification (
`id` int(10) not null primary key auto_increment,
`from` int(10) not null,
`to` int(10) not null,
`content` text,
`created_at` real
) engine=innodb default charse=utf8;
create table abuse_report (
`id` int(10) not null primary key auto_increment,
`from` int(10) not null,
`target` int(10) not null,
`content` text,
`created_at` real
) engine=innodb default charset=utf8;
create table license (
`id` int(9) not null primary key auto_increment,
`content` text
) engine=innodb default charset=utf8;
create table horoscope (
`id` int(9) not null primary key auto_increment,
`name` text,
`desc` text
) engine=innodb default charset=utf8;
create table province (
`id` int(9) not null primary key auto_increment,
`name` text
) engine=innodb default charset=utf8;
create table city (
`id` int(9) not null primary key auto_increment,
`province` int(9) not null,
`name` text
) engine=innodb default charset=utf8;
create table schools (
`id` int(9) not null primary key auto_increment,
`name` text
) engine=innodb default charset=utf8;