@@ -0,0 +1,33 @@
|
||||
CREATE TABLE bughunter_hunts (
|
||||
id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
||||
slug VARCHAR(150) NOT NULL UNIQUE,
|
||||
title VARCHAR(200) NOT NULL,
|
||||
code_language VARCHAR(50) NOT NULL DEFAULT 'Java',
|
||||
difficulty VARCHAR(30) NOT NULL DEFAULT 'junior',
|
||||
exam_scope VARCHAR(20) NOT NULL DEFAULT 'AP1',
|
||||
description VARCHAR(1200),
|
||||
briefing VARCHAR(2000),
|
||||
console_output VARCHAR(4000),
|
||||
sort_order INT NOT NULL DEFAULT 0,
|
||||
active BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
CONSTRAINT chk_bughunter_exam_scope CHECK (exam_scope IN ('AP1','AP2_FIAE','AP2_FISI','CROSS'))
|
||||
);
|
||||
|
||||
CREATE TABLE bughunter_files (
|
||||
id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
||||
hunt_id BIGINT NOT NULL REFERENCES bughunter_hunts(id) ON DELETE CASCADE,
|
||||
filename VARCHAR(255) NOT NULL,
|
||||
content VARCHAR(8000) NOT NULL,
|
||||
sort_order INT NOT NULL DEFAULT 0
|
||||
);
|
||||
|
||||
CREATE TABLE bughunter_bugs (
|
||||
id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
||||
hunt_id BIGINT NOT NULL REFERENCES bughunter_hunts(id) ON DELETE CASCADE,
|
||||
points INT NOT NULL DEFAULT 100,
|
||||
sort_order INT NOT NULL DEFAULT 0,
|
||||
payload VARCHAR(8000) NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX idx_bughunter_files_hunt ON bughunter_files(hunt_id);
|
||||
CREATE INDEX idx_bughunter_bugs_hunt ON bughunter_bugs(hunt_id);
|
||||
Reference in New Issue
Block a user