From ff4e55615fa63707d7ddf2cf2487496f617641ba Mon Sep 17 00:00:00 2001 From: Hugo LIVET Date: Wed, 14 Dec 2022 13:58:01 +0100 Subject: [PATCH] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'Sources/Data/table?= =?UTF-8?q?s.sql'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{tablewithgeneratedid.sql => tables.sql} | 53 +++++++++---------- 1 file changed, 26 insertions(+), 27 deletions(-) rename Sources/Data/{tablewithgeneratedid.sql => tables.sql} (62%) diff --git a/Sources/Data/tablewithgeneratedid.sql b/Sources/Data/tables.sql similarity index 62% rename from Sources/Data/tablewithgeneratedid.sql rename to Sources/Data/tables.sql index d9c66bd..2bb239c 100644 --- a/Sources/Data/tablewithgeneratedid.sql +++ b/Sources/Data/tables.sql @@ -1,12 +1,12 @@ -DROP TABLE Planification; -DROP TABLE Opération; -DROP TABLE Echeancier; -DROP TABLE Compte; -DROP TABLE InscrBanque; -DROP TABLE Banque; -DROP TABLE DeviseInscrit; -DROP TABLE Inscrit; -DROP TABLE Devise; +DROP TABLE if exists Planification; +DROP TABLE if exists Operation; +DROP TABLE if exists Echeancier; +DROP TABLE if exists Compte; +DROP TABLE if exists InscrBanque; +DROP TABLE if exists Banque; +DROP TABLE if exists DeviseInscrit; +DROP TABLE if exists Inscrit; +DROP TABLE if exists Devise; CREATE TABLE Devise @@ -17,7 +17,7 @@ CREATE TABLE Devise CREATE TABLE Inscrit ( - id serial PRIMARY KEY, + id MEDIUMINT PRIMARY KEY AUTO_INCREMENT, nom varchar(40), prenom varchar(40), mail varchar(40) UNIQUE, @@ -27,7 +27,7 @@ CREATE TABLE Inscrit CREATE TABLE DeviseInscrit ( devise char(3), - idInscrit serial UNIQUE, + idInscrit MEDIUMINT UNIQUE, PRIMARY KEY(devise,idInscrit), FOREIGN KEY (devise) REFERENCES Devise(id), FOREIGN KEY (idInscrit) REFERENCES Inscrit(id) @@ -37,15 +37,14 @@ CREATE TABLE Banque ( nom varchar(40) PRIMARY KEY, urlsite varchar(60), - urllogo varchar(60), - urldl varchar(500) + urllogo longblob ); CREATE TABLE InscrBanque ( - id serial PRIMARY KEY, + id MEDIUMINT PRIMARY KEY AUTO_INCREMENT, nomBanque varchar(40), - idInscrit serial, + idInscrit MEDIUMINT, UNIQUE(nomBanque,idInscrit), FOREIGN KEY (nomBanque) REFERENCES Banque(nom), FOREIGN KEY (idInscrit) REFERENCES Inscrit(id) @@ -53,34 +52,34 @@ CREATE TABLE InscrBanque CREATE TABLE Compte ( - id serial PRIMARY KEY, + id MEDIUMINT PRIMARY KEY AUTO_INCREMENT, nom varchar(40), - idInscritBanque serial, + idInscritBanque MEDIUMINT, FOREIGN KEY (idInscritBanque) REFERENCES InscrBanque(id), UNIQUE(idInscritBanque,nom) ); CREATE TABLE Echeancier ( - id serial PRIMARY KEY, + id MEDIUMINT PRIMARY KEY AUTO_INCREMENT, nom varchar(40), credit numeric, - compte serial, + compte MEDIUMINT, debit numeric, dateE date, datecrea date, methodePayement varchar(20), - CONSTRAINT ck_methPaye CHECK (methodePayement IN ('CB','Cheque','Espece','Prélevement')), + CONSTRAINT ck_echan CHECK (methodePayement IN ('CB','Cheque','Espece','Prélevement')), FOREIGN KEY(compte) REFERENCES Compte(id), UNIQUE (datecrea,compte) ); -CREATE TABLE Opération +CREATE TABLE Operation ( - id serial PRIMARY KEY, + id MEDIUMINT PRIMARY KEY AUTO_INCREMENT, nom varchar(40), credit numeric, - compte serial, + compte MEDIUMINT, debit numeric, dateO date, datecrea date, @@ -92,15 +91,15 @@ CREATE TABLE Opération CREATE TABLE Planification ( - id serial PRIMARY KEY, + id MEDIUMINT PRIMARY KEY AUTO_INCREMENT, nom varchar(40), credit numeric, - compte serial, + compte MEDIUMINT, debit numeric, dateP date, datecrea date, methodePayement varchar(20), - CONSTRAINT ck_methPaye CHECK (methodePayement IN ('CB','Cheque','Espece','Prélevement')), + CONSTRAINT ck_planif CHECK (methodePayement IN ('CB','Cheque','Espece','Prélevement')), FOREIGN KEY(compte) REFERENCES Compte(id), UNIQUE (datecrea,compte) -);, \ No newline at end of file +); \ No newline at end of file