-
Notifications
You must be signed in to change notification settings - Fork 31
/
bnuoj-schema-oi.sql
274 lines (235 loc) · 7.94 KB
/
bnuoj-schema-oi.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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
-- phpMyAdmin SQL Dump
-- version 3.3.9.2
-- http://www.phpmyadmin.net
--
-- 主机: localhost
-- 生成日期: 2013 年 11 月 24 日 14:20
-- 服务器版本: 5.1.66
-- PHP 版本: 5.3.3-7+squeeze15
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
-- 数据库: `bnuojoi`
--
DROP DATABASE `bnuojoi`;
CREATE DATABASE `bnuojoi` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `bnuojoi`;
-- --------------------------------------------------------
--
-- 表的结构 `contest`
--
DROP TABLE IF EXISTS `contest`;
CREATE TABLE IF NOT EXISTS `contest` (
`cid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(255) DEFAULT NULL,
`description` text,
`isprivate` tinyint(1) NOT NULL,
`start_time` datetime NOT NULL,
`end_time` datetime NOT NULL,
`lock_board_time` datetime NOT NULL,
`hide_others` tinyint(1) NOT NULL,
`board_make` datetime NOT NULL,
PRIMARY KEY (`cid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Contest List';
-- --------------------------------------------------------
--
-- 表的结构 `contest_clarify`
--
DROP TABLE IF EXISTS `contest_clarify`;
CREATE TABLE IF NOT EXISTS `contest_clarify` (
`ccid` int(11) NOT NULL AUTO_INCREMENT,
`cid` int(11) NOT NULL,
`question` text NOT NULL,
`reply` text NOT NULL,
`username` varchar(255) NOT NULL,
`ispublic` tinyint(1) NOT NULL,
PRIMARY KEY (`ccid`),
KEY `cid` (`cid`),
KEY `username` (`username`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `contest_problem`
--
DROP TABLE IF EXISTS `contest_problem`;
CREATE TABLE IF NOT EXISTS `contest_problem` (
`cpid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`cid` int(10) unsigned NOT NULL,
`pid` int(10) unsigned NOT NULL,
`lable` varchar(20) NOT NULL,
PRIMARY KEY (`cpid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Contest, its problems and their status';
-- --------------------------------------------------------
--
-- 表的结构 `contest_user`
--
DROP TABLE IF EXISTS `contest_user`;
CREATE TABLE IF NOT EXISTS `contest_user` (
`cuid` int(11) NOT NULL AUTO_INCREMENT,
`cid` int(10) unsigned NOT NULL,
`username` varchar(255) NOT NULL,
PRIMARY KEY (`cuid`),
KEY `cuid` (`cuid`),
KEY `cid` (`cid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- 表的结构 `mail`
--
DROP TABLE IF EXISTS `mail`;
CREATE TABLE IF NOT EXISTS `mail` (
`mailid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`sender` varchar(255) NOT NULL,
`reciever` varchar(255) NOT NULL,
`title` varchar(1024) NOT NULL,
`content` text NOT NULL,
`mail_time` datetime NOT NULL,
`status` tinyint(1) NOT NULL,
PRIMARY KEY (`mailid`),
KEY `sender` (`sender`),
KEY `reciever` (`reciever`),
KEY `mail_time` (`mail_time`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Mail List';
-- --------------------------------------------------------
--
-- 表的结构 `news`
--
DROP TABLE IF EXISTS `news`;
CREATE TABLE IF NOT EXISTS `news` (
`newsid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`time_added` datetime NOT NULL,
`title` varchar(1024) DEFAULT NULL,
`content` text,
`author` varchar(255) DEFAULT NULL,
PRIMARY KEY (`newsid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='News List';
-- --------------------------------------------------------
--
-- 表的结构 `problem`
--
DROP TABLE IF EXISTS `problem`;
CREATE TABLE IF NOT EXISTS `problem` (
`pid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(255) DEFAULT NULL,
`description` text,
`input` text,
`output` text,
`sample_in` text,
`sample_out` text,
`number_of_testcase` int(10) unsigned NOT NULL,
`total_submit` int(10) unsigned NOT NULL,
`total_ac` int(10) unsigned NOT NULL,
`total_wa` int(10) unsigned NOT NULL,
`total_re` int(10) unsigned NOT NULL,
`total_ce` int(10) unsigned NOT NULL,
`total_tle` int(10) unsigned NOT NULL,
`total_mle` int(10) unsigned NOT NULL,
`total_pe` int(10) unsigned NOT NULL,
`total_ole` int(10) unsigned NOT NULL,
`total_rf` int(10) unsigned NOT NULL,
`special_judge_status` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'have special judger?',
`basic_solver_value` int(10) unsigned NOT NULL COMMENT 'the basic value for submitting a solver to this problem',
`ac_value` int(10) unsigned NOT NULL COMMENT 'value for acceptting this problem',
`time_limit` int(10) unsigned NOT NULL,
`case_time_limit` int(10) unsigned NOT NULL,
`memory_limit` int(10) unsigned NOT NULL DEFAULT '0',
`hint` text,
`source` text,
`hide` tinyint(1) NOT NULL,
`vid` int(11) NOT NULL,
`vname` varchar(50) NOT NULL,
`isvirtual` tinyint(1) NOT NULL,
PRIMARY KEY (`pid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Problem list';
-- --------------------------------------------------------
--
-- 替换视图以便查看 `ranklist`
--
DROP VIEW IF EXISTS `ranklist`;
CREATE TABLE IF NOT EXISTS `ranklist` (
`uid` int(10) unsigned
,`username` varchar(255)
,`nickname` varchar(1024)
,`total_ac` int(10) unsigned
,`total_submit` int(10) unsigned
);
-- --------------------------------------------------------
--
-- 表的结构 `solver`
--
DROP TABLE IF EXISTS `solver`;
CREATE TABLE IF NOT EXISTS `solver` (
`solverid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`pid` int(10) unsigned NOT NULL,
`value` int(10) unsigned NOT NULL,
`filename` varchar(1024) NOT NULL,
`owner` varchar(255) NOT NULL,
PRIMARY KEY (`solverid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Solver List';
-- --------------------------------------------------------
--
-- 表的结构 `solverlist`
--
DROP TABLE IF EXISTS `solverlist`;
CREATE TABLE IF NOT EXISTS `solverlist` (
`uid` int(10) unsigned NOT NULL,
`solverid` int(10) unsigned NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Solver Bought';
-- --------------------------------------------------------
--
-- 表的结构 `status`
--
DROP TABLE IF EXISTS `status`;
CREATE TABLE IF NOT EXISTS `status` (
`runid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`pid` int(10) unsigned NOT NULL,
`result` varchar(5000) DEFAULT NULL,
`memory_used` int(11) DEFAULT NULL,
`time_used` int(11) DEFAULT NULL,
`time_submit` datetime DEFAULT NULL,
`contest_belong` int(10) unsigned NOT NULL,
`username` varchar(255) DEFAULT NULL,
`source` text,
`language` int(10) unsigned NOT NULL COMMENT '1cpp 2c 3java 4pas',
`ce_info` text,
`ipaddr` varchar(255) DEFAULT NULL,
`isshared` tinyint(1) NOT NULL,
PRIMARY KEY (`runid`),
KEY `pid` (`pid`),
KEY `result` (`result`(333)),
KEY `time_submit` (`time_submit`),
KEY `contest_belong` (`contest_belong`),
KEY `username` (`username`),
KEY `isshared` (`isshared`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Problem Status';
-- --------------------------------------------------------
--
-- 表的结构 `user`
--
DROP TABLE IF EXISTS `user`;
CREATE TABLE IF NOT EXISTS `user` (
`uid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(255) DEFAULT NULL,
`nickname` varchar(1024) DEFAULT NULL,
`password` char(50) NOT NULL,
`email` varchar(255) DEFAULT NULL,
`school` varchar(255) DEFAULT NULL,
`total_submit` int(10) unsigned NOT NULL,
`total_ac` int(10) unsigned NOT NULL,
`register_time` datetime NOT NULL,
`last_login_time` datetime NOT NULL,
`photo` varchar(255) DEFAULT NULL,
`total_value` int(10) unsigned NOT NULL,
`lock_status` tinyint(1) NOT NULL DEFAULT '0',
`isroot` tinyint(1) NOT NULL,
`ipaddr` varchar(255) DEFAULT NULL,
PRIMARY KEY (`uid`),
KEY `username` (`username`),
KEY `nickname` (`nickname`(333)),
KEY `password` (`password`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='User List';
-- --------------------------------------------------------
--
-- 视图结构 `ranklist`
--
DROP TABLE IF EXISTS `ranklist`;
CREATE VIEW `ranklist` AS select `user`.`uid` AS `uid`,`user`.`username` AS `username`,`user`.`nickname` AS `nickname`,`user`.`total_ac` AS `total_ac`,`user`.`total_submit` AS `total_submit` from `user` order by `user`.`total_ac` desc,`user`.`total_submit`;