From 394d8217d2d26631dc5c2e987b52d66c819f028b Mon Sep 17 00:00:00 2001 From: "maxime.rocher" Date: Wed, 27 Nov 2024 08:51:19 +0100 Subject: [PATCH] meilleur config bdd --- insert_all_data.sql | 8 ++------ scripts/init.sql | 7 ++++++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/insert_all_data.sql b/insert_all_data.sql index 922aca4..545a96e 100644 --- a/insert_all_data.sql +++ b/insert_all_data.sql @@ -563,9 +563,5 @@ VALUES (3, 3, 0, 10), (3, 1, 14, 45); -UPDATE Quote -SET isCitationDuJour = false -where id_quote!=185; -UPDATE Quote -SET isCitationDuJour = true -where id_quote=185; +INSERT INTO DailyQuote (citation_id) +VALUES(120); diff --git a/scripts/init.sql b/scripts/init.sql index c572d35..ca47995 100644 --- a/scripts/init.sql +++ b/scripts/init.sql @@ -93,7 +93,6 @@ CREATE TABLE Quote( id_caracter SERIAL NOT NULL, id_source SERIAL NOT NULL, id_user_verif SERIAL NOT NULL, - isCitationDuJour boolean NOT NULL DEFAULT 'false', CONSTRAINT fk_caracter FOREIGN KEY(id_caracter) REFERENCES Caracter(id_caracter), CONSTRAINT fk_source FOREIGN KEY(id_source) REFERENCES Source(id_source), CONSTRAINT fk_userverif FOREIGN KEY(id_user_verif) REFERENCES Users(id_user), @@ -101,6 +100,12 @@ CREATE TABLE Quote( CONSTRAINT err_language CHECK (langue = 'fr' OR langue = 'en') ); +CREATE TABLE DailyQuote( + citation_id INT PRIMARY KEY, + FOREIGN KEY (citation_id) REFERENCES Citation(id) ON DELETE CASCADE +); + + CREATE TABLE Favorite( users SERIAL NOT NULL, quote SERIAL NOT NULL,