3
-- http://www.phpmyadmin.net
6
-- Generation Time: Feb 27, 2008 at 04:58 PM
7
-- Server version: 3.23.32
8
-- PHP Version: 5.2.3-1ubuntu6.3
10
SET FOREIGN_KEY_CHECKS=0;
17
-- Database: `codescore`
19
DROP DATABASE `codescore`;
20
CREATE DATABASE `codescore`;
23
-- --------------------------------------------------------
26
-- Table structure for table `clarifications`
29
DROP TABLE IF EXISTS `clarifications`;
30
CREATE TABLE IF NOT EXISTS `clarifications` (
31
`CID` int(11) NOT NULL auto_increment,
34
`CompID` int(11) NOT NULL,
36
KEY `CompID` (`CompID`)
37
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
39
-- --------------------------------------------------------
42
-- Table structure for table `competitions`
45
DROP TABLE IF EXISTS `competitions`;
46
CREATE TABLE IF NOT EXISTS `competitions` (
47
`CompID` int(11) NOT NULL auto_increment,
48
`EndTime` timestamp NOT NULL default '0000-00-00 00:00:00',
49
`Name` varchar(255) NOT NULL,
50
`StartTime` timestamp NOT NULL default '0000-00-00 00:00:00',
51
PRIMARY KEY (`CompID`)
52
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
54
-- --------------------------------------------------------
57
-- Table structure for table `competitors`
60
DROP TABLE IF EXISTS `competitors`;
61
CREATE TABLE IF NOT EXISTS `competitors` (
62
`CID` int(11) NOT NULL,
63
`PID` int(11) NOT NULL,
64
`TID` int(11) NOT NULL,
65
PRIMARY KEY (`CID`,`PID`,`TID`),
68
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
70
-- --------------------------------------------------------
73
-- Table structure for table `compileargs`
76
DROP TABLE IF EXISTS `compileargs`;
77
CREATE TABLE IF NOT EXISTS `compileargs` (
78
`ArgID` int(11) NOT NULL auto_increment,
79
`LangID` int(11) NOT NULL,
80
`Position` int(11) NOT NULL,
81
`Val` varchar(255) NOT NULL,
82
PRIMARY KEY (`ArgID`),
83
KEY `LangID` (`LangID`)
84
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;
86
-- --------------------------------------------------------
89
-- Table structure for table `executeargs`
92
DROP TABLE IF EXISTS `executeargs`;
93
CREATE TABLE IF NOT EXISTS `executeargs` (
94
`ArgID` int(11) NOT NULL auto_increment,
95
`LangID` int(11) NOT NULL,
96
`Position` int(11) NOT NULL,
97
`Val` varchar(255) NOT NULL,
98
PRIMARY KEY (`ArgID`),
99
KEY `LangID` (`LangID`)
100
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
102
-- --------------------------------------------------------
105
-- Table structure for table `judgecredentials`
108
DROP TABLE IF EXISTS `judgecredentials`;
109
CREATE TABLE IF NOT EXISTS `judgecredentials` (
110
`CID` int(11) NOT NULL auto_increment,
111
`Password` varchar(255) default NULL,
112
`PersonID` int(11) default NULL,
114
KEY `PersonID` (`PersonID`)
115
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
117
-- --------------------------------------------------------
120
-- Table structure for table `languages`
123
DROP TABLE IF EXISTS `languages`;
124
CREATE TABLE IF NOT EXISTS `languages` (
125
`FileExtention` varchar(16) NOT NULL,
126
`LID` int(11) NOT NULL auto_increment,
127
`Name` varchar(255) NOT NULL,
129
UNIQUE KEY `Name` (`Name`)
130
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
132
-- --------------------------------------------------------
135
-- Table structure for table `people`
138
DROP TABLE IF EXISTS `people`;
139
CREATE TABLE IF NOT EXISTS `people` (
140
`Name` varchar(255) NOT NULL,
141
`PersonID` int(11) NOT NULL auto_increment,
142
`School` int(11) NOT NULL,
143
`IsJudge` tinyint(1) default NULL,
144
PRIMARY KEY (`PersonID`),
145
UNIQUE KEY `Name` (`Name`,`School`)
146
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
148
-- --------------------------------------------------------
151
-- Table structure for table `problems`
154
DROP TABLE IF EXISTS `problems`;
155
CREATE TABLE IF NOT EXISTS `problems` (
156
`Description` longtext,
157
`Name` varchar(255) NOT NULL,
158
`ProblemID` int(11) NOT NULL auto_increment,
159
`SampleInput` longtext,
160
`UnixName` varchar(128) NOT NULL,
161
`Active` tinyint(1) NOT NULL default '1',
162
`SampleOutput` longtext,
163
PRIMARY KEY (`ProblemID`),
164
UNIQUE KEY `UnixName` (`UnixName`),
165
UNIQUE KEY `Name` (`Name`)
166
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
168
-- --------------------------------------------------------
171
-- Table structure for table `problemset`
174
DROP TABLE IF EXISTS `problemset`;
175
CREATE TABLE IF NOT EXISTS `problemset` (
176
`CompID` int(11) NOT NULL,
177
`ProbID` int(11) NOT NULL,
178
PRIMARY KEY (`CompID`,`ProbID`),
179
KEY `ProbID` (`ProbID`)
180
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
182
-- --------------------------------------------------------
185
-- Table structure for table `problemstatus`
188
DROP TABLE IF EXISTS `problemstatus`;
189
CREATE TABLE IF NOT EXISTS `problemstatus` (
190
`Name` varchar(255) default NULL,
191
`StatID` int(11) NOT NULL auto_increment,
192
PRIMARY KEY (`StatID`)
193
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
195
-- --------------------------------------------------------
198
-- Table structure for table `schools`
201
DROP TABLE IF EXISTS `schools`;
202
CREATE TABLE IF NOT EXISTS `schools` (
203
`Name` varchar(255) NOT NULL,
204
`SchoolID` int(11) NOT NULL auto_increment,
205
PRIMARY KEY (`SchoolID`),
206
UNIQUE KEY `Name` (`Name`)
207
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
209
-- --------------------------------------------------------
212
-- Table structure for table `submission`
215
DROP TABLE IF EXISTS `submission`;
216
CREATE TABLE IF NOT EXISTS `submission` (
217
`CompileStdErr` longtext,
218
`CompileStdOut` longtext,
219
`ExeStdErr` longtext,
220
`ExeStdOut` longtext,
221
`LangID` int(11) NOT NULL,
222
`PID` int(11) NOT NULL,
223
`Points` int(11) NOT NULL,
224
`SID` int(11) NOT NULL auto_increment,
226
`Stat` int(11) default NULL,
227
`TID` int(11) NOT NULL,
228
`Time` timestamp NULL default NULL,
229
`StdOutDiff` longtext,
230
PRIMARY KEY (`SID`,`PID`,`TID`),
231
KEY `LangID` (`LangID`),
235
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=16 ;
237
-- --------------------------------------------------------
240
-- Table structure for table `teamcredentials`
243
DROP TABLE IF EXISTS `teamcredentials`;
244
CREATE TABLE IF NOT EXISTS `teamcredentials` (
245
`CompID` int(11) NOT NULL,
246
`Password` varchar(255) NOT NULL,
247
`TID` int(11) NOT NULL,
248
PRIMARY KEY (`CompID`,`TID`),
250
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
252
-- --------------------------------------------------------
255
-- Table structure for table `teams`
258
DROP TABLE IF EXISTS `teams`;
259
CREATE TABLE IF NOT EXISTS `teams` (
260
`Name` varchar(255) NOT NULL,
261
`School` int(11) NOT NULL,
262
`TeamID` int(11) NOT NULL auto_increment,
263
PRIMARY KEY (`TeamID`),
264
UNIQUE KEY `Name` (`Name`,`School`),
265
KEY `School` (`School`)
266
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=16 ;
268
-- --------------------------------------------------------
271
-- Table structure for table `testcases`
274
DROP TABLE IF EXISTS `testcases`;
275
CREATE TABLE IF NOT EXISTS `testcases` (
276
`CaseID` int(11) NOT NULL auto_increment,
277
`Input` longtext NOT NULL,
278
`Output` longtext NOT NULL,
279
`ProbID` int(11) NOT NULL,
280
`Active` tinyint(1) NOT NULL default '1',
281
PRIMARY KEY (`CaseID`),
282
KEY `ProbID` (`ProbID`)
283
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
286
-- Constraints for dumped tables
290
-- Constraints for table `clarifications`
292
ALTER TABLE `clarifications`
293
ADD CONSTRAINT `clarifications_ibfk_1` FOREIGN KEY (`CompID`) REFERENCES `competitions` (`CompID`),
294
ADD CONSTRAINT `clarifications_ibfk_2` FOREIGN KEY (`CompID`) REFERENCES `competitions` (`CompID`) ON DELETE CASCADE ON UPDATE CASCADE;
297
-- Constraints for table `competitors`
299
ALTER TABLE `competitors`
300
ADD CONSTRAINT `competitors_ibfk_1` FOREIGN KEY (`CID`) REFERENCES `competitions` (`CompID`) ON DELETE CASCADE ON UPDATE CASCADE,
301
ADD CONSTRAINT `competitors_ibfk_2` FOREIGN KEY (`PID`) REFERENCES `people` (`PersonID`) ON DELETE CASCADE ON UPDATE CASCADE,
302
ADD CONSTRAINT `competitors_ibfk_3` FOREIGN KEY (`TID`) REFERENCES `teams` (`TeamID`) ON DELETE CASCADE ON UPDATE CASCADE;
305
-- Constraints for table `compileargs`
307
ALTER TABLE `compileargs`
308
ADD CONSTRAINT `compileargs_ibfk_1` FOREIGN KEY (`LangID`) REFERENCES `languages` (`LID`) ON DELETE CASCADE ON UPDATE CASCADE;
311
-- Constraints for table `executeargs`
313
ALTER TABLE `executeargs`
314
ADD CONSTRAINT `executeargs_ibfk_1` FOREIGN KEY (`LangID`) REFERENCES `languages` (`LID`) ON DELETE CASCADE ON UPDATE CASCADE;
317
-- Constraints for table `judgecredentials`
319
ALTER TABLE `judgecredentials`
320
ADD CONSTRAINT `judgecredentials_ibfk_1` FOREIGN KEY (`PersonID`) REFERENCES `people` (`PersonID`),
321
ADD CONSTRAINT `judgecredentials_ibfk_2` FOREIGN KEY (`PersonID`) REFERENCES `people` (`PersonID`) ON DELETE CASCADE ON UPDATE CASCADE;
324
-- Constraints for table `problemset`
326
ALTER TABLE `problemset`
327
ADD CONSTRAINT `problemset_ibfk_1` FOREIGN KEY (`CompID`) REFERENCES `competitions` (`CompID`) ON DELETE CASCADE ON UPDATE CASCADE,
328
ADD CONSTRAINT `problemset_ibfk_2` FOREIGN KEY (`ProbID`) REFERENCES `problems` (`ProblemID`) ON DELETE CASCADE ON UPDATE CASCADE;
331
-- Constraints for table `submission`
333
ALTER TABLE `submission`
334
ADD CONSTRAINT `submission_ibfk_1` FOREIGN KEY (`LangID`) REFERENCES `languages` (`LID`) ON DELETE CASCADE ON UPDATE CASCADE,
335
ADD CONSTRAINT `submission_ibfk_2` FOREIGN KEY (`PID`) REFERENCES `problems` (`ProblemID`) ON DELETE CASCADE ON UPDATE CASCADE,
336
ADD CONSTRAINT `submission_ibfk_3` FOREIGN KEY (`Stat`) REFERENCES `problemstatus` (`StatID`) ON DELETE CASCADE ON UPDATE CASCADE,
337
ADD CONSTRAINT `submission_ibfk_4` FOREIGN KEY (`TID`) REFERENCES `teams` (`TeamID`) ON DELETE CASCADE ON UPDATE CASCADE;
340
-- Constraints for table `teamcredentials`
342
ALTER TABLE `teamcredentials`
343
ADD CONSTRAINT `teamcredentials_ibfk_1` FOREIGN KEY (`CompID`) REFERENCES `competitions` (`CompID`),
344
ADD CONSTRAINT `teamcredentials_ibfk_2` FOREIGN KEY (`TID`) REFERENCES `teams` (`TeamID`),
345
ADD CONSTRAINT `teamcredentials_ibfk_3` FOREIGN KEY (`CompID`) REFERENCES `competitions` (`CompID`) ON DELETE CASCADE ON UPDATE CASCADE,
346
ADD CONSTRAINT `teamcredentials_ibfk_4` FOREIGN KEY (`TID`) REFERENCES `teams` (`TeamID`) ON DELETE CASCADE ON UPDATE CASCADE;
349
-- Constraints for table `teams`
352
ADD CONSTRAINT `teams_ibfk_1` FOREIGN KEY (`School`) REFERENCES `schools` (`SchoolID`) ON DELETE CASCADE ON UPDATE CASCADE;
355
-- Constraints for table `testcases`
357
ALTER TABLE `testcases`
358
ADD CONSTRAINT `testcases_ibfk_1` FOREIGN KEY (`ProbID`) REFERENCES `problems` (`ProblemID`) ON DELETE CASCADE ON UPDATE CASCADE;
360
SET FOREIGN_KEY_CHECKS=1;