Compare commits
No commits in common. "a09a5594ecb8a72851f82a6d7fe324a6678e2bc5" and "0674bd2461541f4bc866278c65a60bfef297ba9f" have entirely different histories.
a09a5594ec
...
0674bd2461
1 changed files with 0 additions and 11 deletions
|
@ -18,7 +18,6 @@ CREATE TABLE IF NOT EXISTS languages
|
|||
CREATE TABLE IF NOT EXISTS problems
|
||||
(
|
||||
id serial NOT NULL,
|
||||
is_uploaded BOOLEAN NOT NULL,
|
||||
name VARCHAR(300) NOT NULL,
|
||||
description TEXT NOT NULL,
|
||||
time_limit INT NOT NULL,
|
||||
|
@ -66,16 +65,6 @@ CREATE INDEX ON tasks USING BTREE (id);
|
|||
CREATE INDEX ON tasks USING BTREE (contest_id);
|
||||
CREATE INDEX ON tasks USING BTREE (problem_id);
|
||||
|
||||
CREATE FUNCTION check_problem_uploaded() RETURNS TRIGGER
|
||||
LANGUAGE plpgsql AS $$ BEGIN
|
||||
IF NOT EXISTS (SELECT (id) FROM problems WHERE id=NEW.problem_id AND is_uploaded=TRUE) THEN
|
||||
RAISE EXCEPTION 'trying to add not uploaded problem';
|
||||
END IF;
|
||||
RETURN NEW;
|
||||
END;$$;
|
||||
|
||||
CREATE TRIGGER check_problem_uploaded_trg BEFORE INSERT ON tasks FOR EACH ROW EXECUTE FUNCTION check_problem_uploaded();
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue