remove problem upload flag

This commit is contained in:
dragonmuffin 2024-08-16 20:47:56 +05:00
parent c0bba6e1c4
commit c14ed9dc3d

View file

@ -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();