Added quizz, answers and security

This commit is contained in:
2025-02-23 10:25:27 +01:00
parent 4f3814bd7e
commit 001ff8b5cb
11 changed files with 216 additions and 22 deletions
@@ -0,0 +1,11 @@
create table answers (id bigint generated by default as identity, value oid, question bigint not null, primary key (id));
create table questions (id bigint generated by default as identity, index integer not null, value oid, quizz bigint not null, primary key (id));
create table quizz (id bigint generated by default as identity, is_public boolean default false not null, name varchar(255) not null, question_count integer default 0 not null, owner bigint, primary key (id));
create table quizzf (id bigint generated by default as identity, answer_step integer not null, current_question integer not null, done boolean not null, quizz bigint not null, answerer bigint not null, primary key (id));
alter table if exists quizz drop constraint if exists UKc1plspc0ecmwqqpfaf24avb4c;
alter table if exists quizz add constraint UKc1plspc0ecmwqqpfaf24avb4c unique (name);
alter table if exists answers add constraint FK54dobrdq2u51m4u8s7kg0as8v foreign key (question) references questions;
alter table if exists questions add constraint FKq12h25ynjok1m497gwos511te foreign key (quizz) references quizz;
alter table if exists quizz add constraint FKfeoogns8m4m4hvno1ttqb30wm foreign key (owner) references users;
alter table if exists quizzf add constraint FK4ukbg2yaa93gs5nx1s5d9rqu4 foreign key (quizz) references quizz;
alter table if exists quizzf add constraint FKuj3h8r3i4lnxukdqobapwbuq foreign key (answerer) references users;