]> iEval git - gruntmaster-data.git/blame_incremental - db.sql
Add documentation for gruntmaster-problem check
[gruntmaster-data.git] / db.sql
... / ...
CommitLineData
1CREATE TABLE users (
2 id TEXT PRIMARY KEY,
3 passphrase TEXT, -- NOT NULL,
4 admin BOOLEAN NOT NULL DEFAULT FALSE,
5 name TEXT, -- NOT NULL,
6 email TEXT, -- NOT NULL,
7 phone TEXT, -- NOT NULL,
8 town TEXT, -- NOT NULL,
9 university TEXT, -- NOT NULL,
10 level TEXT, -- NOT NULL,
11 country TEXT,
12 lastjob BIGINT,
13 since BIGINT DEFAULT CAST(EXTRACT(epoch from now()) AS bigint)
14);
15
16CREATE TABLE contests (
17 id TEXT PRIMARY KEY,
18 name TEXT NOT NULL,
19 editorial TEXT,
20 description TEXT,
21 start INT NOT NULL,
22 stop INT NOT NULL,
23 owner TEXT NOT NULL REFERENCES users ON DELETE CASCADE,
24 CONSTRAINT positive_duration CHECK (stop > start)
25);
26
27CREATE TABLE contest_status (
28 contest TEXT NOT NULL REFERENCES contests ON DELETE CASCADE,
29 owner TEXT NOT NULL REFERENCES users ON DELETE CASCADE,
30 score INT NOT NULL,
31 rank INT NOT NULL,
32
33 PRIMARY KEY (owner, contest)
34);
35
36CREATE TABLE problems (
37 id TEXT PRIMARY KEY,
38 author TEXT,
39 writer TEXT,
40 generator TEXT NOT NULL,
41 judge TEXT NOT NULL,
42 level TEXT NOT NULL,
43 name TEXT NOT NULL,
44 olimit INT,
45 owner TEXT NOT NULL REFERENCES users ON DELETE CASCADE,
46 private BOOLEAN NOT NULL DEFAULT FALSE,
47 runner TEXT NOT NULL,
48 solution TEXT ,
49 statement TEXT NOT NULL,
50 testcnt INT NOT NULL,
51 precnt INT,
52 tests TEXT,
53 timeout REAL NOT NULL,
54 value INT NOT NULL,
55 genformat TEXT,
56 gensource TEXT,
57 verformat TEXT,
58 versource TEXT
59);
60
61CREATE TABLE contest_problems (
62 contest TEXT REFERENCES contests ON DELETE CASCADE,
63 problem TEXT NOT NULL REFERENCES problems ON DELETE CASCADE,
64 PRIMARY KEY (contest, problem)
65);
66
67CREATE TABLE jobs (
68 id SERIAL PRIMARY KEY,
69 contest TEXT REFERENCES contests ON DELETE CASCADE,
70 daemon TEXT,
71 date BIGINT NOT NULL,
72 errors TEXT,
73 extension TEXT NOT NULL,
74 format TEXT NOT NULL,
75 private BOOLEAN NOT NULL DEFAULT FALSE,
76 problem TEXT NOT NULL REFERENCES problems ON DELETE CASCADE,
77 reference INT,
78 result INT,
79 result_text TEXT,
80 results TEXT,
81 source TEXT NOT NULL,
82 owner TEXT NOT NULL REFERENCES users ON DELETE CASCADE
83);
84
85CREATE TABLE problem_status (
86 problem TEXT NOT NULL REFERENCES problems ON DELETE CASCADE,
87 owner TEXT NOT NULL REFERENCES users ON DELETE CASCADE,
88 job SERIAL NOT NULL REFERENCES jobs ON DELETE CASCADE,
89 solved BOOLEAN NOT NULL DEFAULT FALSE,
90
91 PRIMARY KEY (owner, problem)
92);
93
94CREATE TABLE opens (
95 contest TEXT NOT NULL REFERENCES contests ON DELETE CASCADE,
96 problem TEXT NOT NULL REFERENCES problems ON DELETE CASCADE,
97 owner TEXT NOT NULL REFERENCES users ON DELETE CASCADE,
98 time BIGINT NOT NULL,
99 PRIMARY KEY (contest, problem, owner)
100);
101
102CREATE TABLE table_comments (
103 table_name TEXT NOT NULL PRIMARY KEY,
104 comment_text TEXT NOT NULL
105);
106
107CREATE TABLE column_comments (
108 table_name TEXT NOT NULL,
109 column_name TEXT NOT NULL,
110 comment_text TEXT NOT NULL,
111 PRIMARY KEY (table_name, column_name)
112);
113
114INSERT INTO table_comments VALUES ('users', 'List of users');
115INSERT INTO table_comments VALUES ('contests', 'List of contests');
116INSERT INTO table_comments VALUES ('contest_status', 'List of (contest, user, result)');
117INSERT INTO table_comments VALUES ('problems', 'List of problems');
118INSERT INTO table_comments VALUES ('contest_problems', 'Many-to-many bridge between contests and problems');
119INSERT INTO table_comments VALUES ('jobs', 'List of jobs');
120INSERT INTO table_comments VALUES ('problem_status', 'List of (problem, user, result)');
121INSERT INTO table_comments VALUES ('opens', 'List of (contest, problem, user, time when user opened problem)');
122
123INSERT INTO column_comments VALUES ('users', 'passphrase', 'RFC2307-encoded passphrase');
124INSERT INTO column_comments VALUES ('users', 'name', 'Full name of user');
125INSERT INTO column_comments VALUES ('users', 'level', 'Highschool, Undergraduate, Master, Doctorate or Other');
126INSERT INTO column_comments VALUES ('users', 'lastjob', 'Unix time when this user last submitted a job');
127INSERT INTO column_comments VALUES ('users', 'since', 'Unix time when this user was created');
128
129INSERT INTO column_comments VALUES ('contests', 'start', 'Unix time when contest starts');
130INSERT INTO column_comments VALUES ('contests', 'stop', 'Unix time when contest ends');
131INSERT INTO column_comments VALUES ('contests', 'editorial', 'HTML fragment placed before the editorial');
132INSERT INTO column_comments VALUES ('contests', 'description', 'HTML fragment placed on contest page');
133
134INSERT INTO column_comments VALUES ('problems', 'author', 'Full name(s) of problem author(s)/problemsetter(s)/tester(s)/etc');
135INSERT INTO column_comments VALUES ('problems', 'writer', 'Full name(s) of statement writer(s) (DEPRECATED)');
136INSERT INTO column_comments VALUES ('problems', 'generator', 'Generator class, without the leading Gruntmaster::Daemon::Generator::');
137INSERT INTO column_comments VALUES ('problems', 'runner', 'Runner class, without the leading Gruntmaster::Daemon::Runner::');
138INSERT INTO column_comments VALUES ('problems', 'judge', 'Judge class, without the leading Gruntmaster::Daemon::Judge::');
139INSERT INTO column_comments VALUES ('problems', 'level', 'Problem level, one of beginner, easy, medium, hard');
140INSERT INTO column_comments VALUES ('problems', 'olimit', 'Output limit (in bytes)');
141INSERT INTO column_comments VALUES ('problems', 'timeout', 'Time limit (in seconds)');
142INSERT INTO column_comments VALUES ('problems', 'solution', 'Solution (HTML)');
143INSERT INTO column_comments VALUES ('problems', 'statement', 'Statement (HTML)');
144INSERT INTO column_comments VALUES ('problems', 'testcnt', 'Number of tests');
145INSERT INTO column_comments VALUES ('problems', 'precnt', 'Number of pretests. NULL indicates full feedback.');
146INSERT INTO column_comments VALUES ('problems', 'tests', 'JSON array of test values for ::Runner::File');
147INSERT INTO column_comments VALUES ('problems', 'value', 'Problem value when used in a contest.');
148INSERT INTO column_comments VALUES ('problems', 'genformat', 'Format (programming language) of the generator if using the Run generator');
149INSERT INTO column_comments VALUES ('problems', 'gensource', 'Source code of generator if using the Run generator');
150INSERT INTO column_comments VALUES ('problems', 'verformat', 'Format (programming language) of the verifier if using the Verifier runner');
151INSERT INTO column_comments VALUES ('problems', 'versource', 'Source code of verifier if using the Verifier runner');
152
153INSERT INTO column_comments VALUES ('jobs', 'daemon', 'hostname:PID of daemon that last executed this job. NULL if never executed');
154INSERT INTO column_comments VALUES ('jobs', 'date', 'Unix time when job was submitted');
155INSERT INTO column_comments VALUES ('jobs', 'errors', 'Compiler errors');
156INSERT INTO column_comments VALUES ('jobs', 'extension', 'File extension of submitted program, without a leading dot');
157INSERT INTO column_comments VALUES ('jobs', 'format', 'Format (programming language) of submitted program');
158INSERT INTO column_comments VALUES ('jobs', 'reference', 'If not null, this is a reference solution that should get this result. For example, set reference=0 on jobs that should be accepted, reference=3 on jobs that should get TLE, etc');
159INSERT INTO column_comments VALUES ('jobs', 'result', 'Job result (integer constant from Gruntmaster::Daemon::Constants)');
160INSERT INTO column_comments VALUES ('jobs', 'result_text', 'Job result (human-readable text)');
161INSERT INTO column_comments VALUES ('jobs', 'results', 'Per-test results (JSON array of hashes with keys id (test number, counting from 1), result (integer constant from Gruntmaster::Daemon::Constants), result_text (human-readable text), time (execution time in decimal seconds))');
162
163INSERT INTO column_comments VALUES ('problem_status', 'solved', 'True if the result is Accepted, False otherwise');
This page took 0.027739 seconds and 4 git commands to generate.