| 1 | CREATE OR REPLACE FUNCTION tm() RETURNS BIGINT IMMUTABLE LANGUAGE SQL AS $$ |
| 2 | SELECT EXTRACT(epoch FROM NOW())::bigint |
| 3 | $$; |
| 4 | |
| 5 | TRUNCATE users, contests, problems, jobs RESTART IDENTITY CASCADE; |
| 6 | |
| 7 | -- USERS |
| 8 | |
| 9 | INSERT INTO users (id, admin) VALUES ('MGV', TRUE); |
| 10 | INSERT INTO users (id, admin) VALUES ('nobody', FALSE); |
| 11 | |
| 12 | -- CONTESTS |
| 13 | |
| 14 | ALTER TABLE contests ALTER owner SET DEFAULT 'MGV'; |
| 15 | |
| 16 | INSERT INTO contests (id, start, stop, name) VALUES ('fc', tm() - 2000, tm() - 1000, 'Finished contest'); |
| 17 | INSERT INTO contests (id, start, stop, name) VALUES ('rc', tm() - 1000, tm() + 1000, 'Running contest'); |
| 18 | INSERT INTO contests (id, start, stop, name) VALUES ('pc', tm() + 1000, tm() + 2000, 'Pending contest'); |
| 19 | |
| 20 | -- PROBLEMS |
| 21 | |
| 22 | ALTER TABLE problems ALTER generator SET DEFAULT 'Undef', |
| 23 | ALTER runner SET DEFAULT 'File', |
| 24 | ALTER judge SET DEFAULT 'Absolute', |
| 25 | ALTER level SET DEFAULT 'beginner', |
| 26 | ALTER value SET DEFAULT 100, |
| 27 | ALTER owner SET DEFAULT 'MGV', |
| 28 | ALTER statement SET DEFAULT 'Sample Text', |
| 29 | ALTER solution SET DEFAULT 'Sample Text', |
| 30 | ALTER testcnt SET DEFAULT 1, |
| 31 | ALTER timeout SET DEFAULT 1; |
| 32 | |
| 33 | INSERT INTO problems (id, name, private) VALUES ('fca', 'FC problem A', FALSE); |
| 34 | INSERT INTO problems (id, name, private) VALUES ('rca', 'RC problem A', TRUE); |
| 35 | INSERT INTO problems (id, name, private) VALUES ('pca', 'PC problem A', TRUE); |
| 36 | INSERT INTO problems (id, name, private) VALUES ('arc', 'Problem in archive', FALSE); |
| 37 | INSERT INTO problems (id, name, private) VALUES ('prv', 'Private problem', TRUE); |
| 38 | |
| 39 | INSERT INTO contest_problems (contest, problem) VALUES ('fc', 'fca'); |
| 40 | INSERT INTO contest_problems (contest, problem) VALUES ('rc', 'rca'); |
| 41 | INSERT INTO contest_problems (contest, problem) VALUES ('pc', 'pca'); |
| 42 | |
| 43 | INSERT INTO limits (problem, format, timeout) VALUES ('arc', 'C', 0.1); |
| 44 | INSERT INTO limits (problem, format, timeout) VALUES ('arc', 'CPP', 0.1); |
| 45 | |
| 46 | -- JOBS |
| 47 | |
| 48 | ALTER TABLE jobs ALTER date SET DEFAULT tm() - 1500, |
| 49 | ALTER errors SET DEFAULT 'Errors here', |
| 50 | ALTER extension SET DEFAULT 'pl', |
| 51 | ALTER format SET DEFAULT 'PERL', |
| 52 | ALTER result SET DEFAULT 0, |
| 53 | ALTER result_text SET DEFAULT 'Accepted', |
| 54 | ALTER results SET DEFAULT '[]', |
| 55 | ALTER source SET DEFAULT 'print "Hello, world!"', |
| 56 | ALTER owner SET DEFAULT 'nobody'; |
| 57 | |
| 58 | INSERT INTO jobs (contest, problem, owner) VALUES ('fc', 'fca', 'MGV'); |
| 59 | INSERT INTO jobs (contest, problem, result, result_text, date) VALUES ('fc', 'fca', 1, 'Wrong Answer', tm() - 1600); |
| 60 | INSERT INTO jobs (contest, problem) VALUES ('fc', 'fca'); |
| 61 | INSERT INTO jobs (problem, date) VALUES ('fca', tm() - 500); |
| 62 | INSERT INTO jobs (problem, date) VALUES ('arc', tm() - 100); |
| 63 | INSERT INTO jobs (problem, private, owner) VALUES ('pca', TRUE, 'MGV'); |
| 64 | INSERT INTO jobs (problem, private, owner, result, result_text, results) VALUES ('prv', TRUE, 'MGV', NULL, NULL, NULL); |