From f4d7b42e74ae2be8e9f77bf17203733c2642d056 Mon Sep 17 00:00:00 2001 From: tomivt Date: Mon, 7 Oct 2024 11:42:33 +0200 Subject: [PATCH] Update Database files --- .$mcd.drawio.bkp | 6 +++--- .$mld.drawio.bkp | 54 ++++++++++++++++++++++++++++++++++++++---------- dbInsertion.py | 2 +- mcd.drawio | 52 ++++++++++++++++++++++++++++++++++++++++------ mld.drawio | 46 ++++++++++++++++++++++++++++++++++++----- script.SQL | 15 +++++++++++--- 6 files changed, 146 insertions(+), 29 deletions(-) diff --git a/.$mcd.drawio.bkp b/.$mcd.drawio.bkp index d439270..bd3780b 100644 --- a/.$mcd.drawio.bkp +++ b/.$mcd.drawio.bkp @@ -1,6 +1,6 @@ - + @@ -183,7 +183,7 @@ - + @@ -252,7 +252,7 @@ - + diff --git a/.$mld.drawio.bkp b/.$mld.drawio.bkp index f856090..56429e3 100644 --- a/.$mld.drawio.bkp +++ b/.$mld.drawio.bkp @@ -1,6 +1,6 @@ - + @@ -52,18 +52,20 @@ + + + + + - + - + - + - - - @@ -150,10 +152,10 @@ - + - + @@ -174,8 +176,38 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dbInsertion.py b/dbInsertion.py index e1395d0..d85a093 100644 --- a/dbInsertion.py +++ b/dbInsertion.py @@ -60,5 +60,5 @@ finally: if co is not None: - print("Déconnexion de la base : dbsae2_04\n") + print("Déconnexion de la base : dbsae2_04") co.close() diff --git a/mcd.drawio b/mcd.drawio index bd3780b..8ea3008 100644 --- a/mcd.drawio +++ b/mcd.drawio @@ -1,11 +1,11 @@ - + - + @@ -22,9 +22,12 @@ - + + + + @@ -136,15 +139,15 @@ - + - + - + @@ -255,6 +258,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mld.drawio b/mld.drawio index 724d448..67a910a 100644 --- a/mld.drawio +++ b/mld.drawio @@ -1,11 +1,11 @@ - + - + @@ -25,6 +25,9 @@ + + + @@ -52,7 +55,7 @@ - + @@ -168,14 +171,47 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/script.SQL b/script.SQL index ec07f90..d8d5ca9 100644 --- a/script.SQL +++ b/script.SQL @@ -1,12 +1,12 @@ - DROP TABLE IF EXISTS Users CASCADE; DROP TABLE IF EXISTS Support CASCADE; DROP TABLE IF EXISTS Quote CASCADE; DROP TABLE IF EXISTS Commentary CASCADE; DROP TABLE IF EXISTS Favorite CASCADE; -DROP TABLE IF EXISTS QuizQuestions CASCADE; DROP TABLE IF EXISTS Quiz CASCADE; DROP TABLE IF EXISTS Question CASCADE; +DROP TABLE IF EXISTS QuizQuestions CASCADE; +DROP TABLE IF EXISTS Results CASCADE; CREATE TABLE Users ( id_user SERIAL PRIMARY KEY, @@ -15,6 +15,7 @@ CREATE TABLE Users ( phone varchar(10) NOT NULL, pssword varchar(99) NOT NULL, creation date NOT NULL, + is_admin boolean NOT NULL, CONSTRAINT unique_col UNIQUE (username, email, phone) ); @@ -74,4 +75,12 @@ CREATE TABLE QuizQuestions ( quiz_qq numeric REFERENCES Quiz(id_quiz), question_qq numeric REFERENCES Question(id_question), CONSTRAINT pk_qq PRIMARY KEY (quiz_qq, question_qq) -); \ No newline at end of file +); + +CREATE TABLE Results ( + score numeric NOT NULL, + p_played numeric NOT NULL, + user_r integer REFERENCES Users(id_user), + quiz_r integer REFERENCES Quiz(id_quiz), + CONSTRAINT pk_results PRIMARY KEY(user_r, quiz_r) +) \ No newline at end of file