-CREATE TYPE ULEVEL AS ENUM ('Highschool', 'Undergraduate', 'Master', 'Doctorate', 'Other');
-CREATE TYPE PLEVEL AS ENUM ('beginner', 'easy', 'medium', 'hard');
-CREATE TYPE GENERATOR AS ENUM ('File', 'Run', 'Undef');
-CREATE TYPE RUNNER AS ENUM ('File', 'Verifier', 'Interactive');
-CREATE TYPE JUDGE AS ENUM ('Absolute', 'Points');
-
CREATE TABLE users (
id TEXT PRIMARY KEY,
- passphrase TEXT NOT NULL,
+ passphrase TEXT, -- NOT NULL,
admin BOOLEAN NOT NULL DEFAULT FALSE,
name TEXT, -- NOT NULL,
email TEXT, -- NOT NULL,
phone TEXT, -- NOT NULL,
town TEXT, -- NOT NULL,
university TEXT, -- NOT NULL,
- level TEXT, --ULEVEL NOT NULL,
+ level TEXT, -- NOT NULL,
lastjob BIGINT
);
name TEXT NOT NULL,
start INT NOT NULL,
stop INT NOT NULL,
- owner TEXT NOT NULL REFERENCES users,
+ owner TEXT NOT NULL REFERENCES users ON DELETE CASCADE,
CONSTRAINT positive_duration CHECK (stop > start)
);
id TEXT PRIMARY KEY,
author TEXT,
writer TEXT,
- generator GENERATOR NOT NULL,
- judge JUDGE NOT NULL,
- level PLEVEL NOT NULL,
- name TEXT NOT NULL,
+ generator TEXT NOT NULL,
+ judge TEXT NOT NULL,
+ level TEXT NOT NULL,
+ name TEXT NOT NULL,
olimit INT,
- owner TEXT NOT NULL REFERENCES users,
- private BOOLEAN NOT NULL DEFAULT FALSE,
- runner RUNNER NOT NULL,
- statement TEXT NOT NULL,
- testcnt INT NOT NULL,
+ owner TEXT NOT NULL REFERENCES users ON DELETE CASCADE,
+ private BOOLEAN NOT NULL DEFAULT FALSE,
+ runner TEXT NOT NULL,
+ statement TEXT NOT NULL,
+ testcnt INT NOT NULL,
tests TEXT,
- timeout REAL NOT NULL,
+ timeout REAL NOT NULL,
value INT,
genformat TEXT,
gensource TEXT,
);
CREATE TABLE contest_problems (
- contest TEXT REFERENCES contests,
- problem TEXT NOT NULL REFERENCES problems,
+ contest TEXT REFERENCES contests ON DELETE CASCADE,
+ problem TEXT NOT NULL REFERENCES problems ON DELETE CASCADE,
PRIMARY KEY (contest, problem)
);
CREATE TABLE jobs (
id SERIAL PRIMARY KEY,
- contest TEXT REFERENCES contests,
+ contest TEXT REFERENCES contests ON DELETE CASCADE,
daemon TEXT,
date BIGINT NOT NULL,
errors TEXT,
extension TEXT NOT NULL,
format TEXT NOT NULL,
private BOOLEAN NOT NULL DEFAULT FALSE,
- problem TEXT NOT NULL REFERENCES problems,
+ problem TEXT NOT NULL REFERENCES problems ON DELETE CASCADE,
result INT,
result_text TEXT,
results TEXT,
source TEXT NOT NULL,
- owner TEXT NOT NULL REFERENCES users
+ owner TEXT NOT NULL REFERENCES users ON DELETE CASCADE
);
CREATE TABLE opens (
- contest TEXT NOT NULL REFERENCES contests,
- problem TEXT NOT NULL REFERENCES problems,
- owner TEXT NOT NULL REFERENCES users,
+ contest TEXT NOT NULL REFERENCES contests ON DELETE CASCADE,
+ problem TEXT NOT NULL REFERENCES problems ON DELETE CASCADE,
+ owner TEXT NOT NULL REFERENCES users ON DELETE CASCADE,
time BIGINT NOT NULL,
PRIMARY KEY (contest, problem, owner)
);
"owner",
"Gruntmaster::Data::Result::User",
{ id => "owner" },
- { is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" },
+ { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" },
);
=head2 problems
__PACKAGE__->many_to_many("problems", "contest_problems", "problem");
-# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-03-06 12:41:16
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:T5tUpU1TOahLKzx9iVie3A
+# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-05-16 15:03:32
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:8PPzBpDmSTq4ukKuxIlLlQ
sub is_pending {
my ($self, $time) = @_;
"contest",
"Gruntmaster::Data::Result::Contest",
{ id => "contest" },
- { is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" },
+ { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" },
);
=head2 problem
"problem",
"Gruntmaster::Data::Result::Problem",
{ id => "problem" },
- { is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" },
+ { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" },
);
-# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-03-06 12:41:16
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:2vVP0Z6QcLz8DiobdOceyQ
+# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-05-16 15:03:32
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fG3PNI7Ar318nxMchtJNuA
# You can replace this text with custom code or comments, and it will be preserved on regeneration
{
is_deferrable => 0,
join_type => "LEFT",
- on_delete => "NO ACTION",
+ on_delete => "CASCADE",
on_update => "NO ACTION",
},
);
"owner",
"Gruntmaster::Data::Result::User",
{ id => "owner" },
- { is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" },
+ { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" },
);
=head2 problem
"problem",
"Gruntmaster::Data::Result::Problem",
{ id => "problem" },
- { is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" },
+ { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" },
);
-# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-03-26 15:24:46
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:dnYOXMU6Or/Wh0m5A1N5UA
+# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-05-16 15:03:32
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:k3Oq7pNqFoCI5NwY5GaWfQ
sub rerun {
shift->update({daemon => undef, result => -2, result_text => undef});
"contest",
"Gruntmaster::Data::Result::Contest",
{ id => "contest" },
- { is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" },
+ { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" },
);
=head2 owner
"owner",
"Gruntmaster::Data::Result::User",
{ id => "owner" },
- { is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" },
+ { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" },
);
=head2 problem
"problem",
"Gruntmaster::Data::Result::Problem",
{ id => "problem" },
- { is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" },
+ { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" },
);
-# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-03-24 09:25:07
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:MgoDt8QyQeSpjIJZEd5RXQ
+# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-05-16 15:03:32
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:VihrUa/CI0cg8k8wpHxQDg
# You can replace this text with custom code or comments, and it will be preserved on regeneration
=head2 generator
- data_type: 'enum'
- extra: {custom_type_name => "generator",list => ["File","Run","Undef"]}
+ data_type: 'text'
is_nullable: 0
=head2 judge
- data_type: 'enum'
- extra: {custom_type_name => "judge",list => ["Absolute","Points"]}
+ data_type: 'text'
is_nullable: 0
=head2 level
- data_type: 'enum'
- extra: {custom_type_name => "plevel",list => ["beginner","easy","medium","hard"]}
+ data_type: 'text'
is_nullable: 0
=head2 name
=head2 runner
- data_type: 'enum'
- extra: {custom_type_name => "runner",list => ["File","Verifier","Interactive"]}
+ data_type: 'text'
is_nullable: 0
=head2 statement
"writer",
{ data_type => "text", is_nullable => 1 },
"generator",
- {
- data_type => "enum",
- extra => { custom_type_name => "generator", list => ["File", "Run", "Undef"] },
- is_nullable => 0,
- },
+ { data_type => "text", is_nullable => 0 },
"judge",
- {
- data_type => "enum",
- extra => { custom_type_name => "judge", list => ["Absolute", "Points"] },
- is_nullable => 0,
- },
+ { data_type => "text", is_nullable => 0 },
"level",
- {
- data_type => "enum",
- extra => {
- custom_type_name => "plevel",
- list => ["beginner", "easy", "medium", "hard"],
- },
- is_nullable => 0,
- },
+ { data_type => "text", is_nullable => 0 },
"name",
{ data_type => "text", is_nullable => 0 },
"olimit",
"private",
{ data_type => "boolean", default_value => \"false", is_nullable => 0 },
"runner",
- {
- data_type => "enum",
- extra => {
- custom_type_name => "runner",
- list => ["File", "Verifier", "Interactive"],
- },
- is_nullable => 0,
- },
+ { data_type => "text", is_nullable => 0 },
"statement",
{ data_type => "text", is_nullable => 0 },
"testcnt",
"owner",
"Gruntmaster::Data::Result::User",
{ id => "owner" },
- { is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" },
+ { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" },
);
=head2 contests
__PACKAGE__->many_to_many("contests", "contest_problems", "contest");
-# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-03-30 12:59:34
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ujwyMJ5Pup1i5NKXkPkg2g
+# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-05-16 15:03:32
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:tvap77v0faSMxFiLu1uggQ
sub is_private {
my ($self, $time) = @_;
=head2 passphrase
data_type: 'text'
- is_nullable: 0
+ is_nullable: 1
=head2 admin
"id",
{ data_type => "text", is_nullable => 0 },
"passphrase",
- { data_type => "text", is_nullable => 0 },
+ { data_type => "text", is_nullable => 1 },
"admin",
{ data_type => "boolean", default_value => \"false", is_nullable => 0 },
"name",
);
-# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-04-18 20:16:26
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:r7hVLUd+6MeYZn+8I4S7Cw
+# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-05-16 15:23:08
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Cho4zmn58Mytf2jHvgP+4g
# You can replace this text with custom code or comments, and it will be preserved on regeneration