Commit 2edef0f3 authored by Adrien Simon's avatar Adrien Simon
Browse files
parents 21111c26 61fec07a
......@@ -10,7 +10,6 @@ DROP TABLE IF EXISTS parking;
DROP TABLE IF EXISTS zone;
DROP TABLE IF EXISTS vehicule;
DROP TABLE IF EXISTS utilisateur;
DROP TYPE IF EXISTS tVehicule;
DROP TYPE IF EXISTS typePaiement;
......@@ -24,19 +23,12 @@ id INTEGER PRIMARY KEY
CREATE TABLE vehicule (
immat VARCHAR PRIMARY KEY,
modele VARCHAR NOT NULL,
marque VARCHAR NOT NULL,
infos JSON,
proprietaire INTEGER NOT NULL,
FOREIGN KEY (proprietaire) REFERENCES utilisateur(id),
FOREIGN KEY (modele,marque) REFERENCES tVehicule(modele,marque)
);
CREATE TABLE tVehicule(
modele VARCHAR NOT NULL,
marque VARCHAR NOT NULL,
type typeVehicule NOT NULL,
PRIMARY KEY (modele,marque)
);
CREATE TABLE zone (
nom VARCHAR PRIMARY KEY,
......@@ -46,12 +38,7 @@ prix FLOAT CHECK (prix>0)
CREATE TABLE parking (
nom VARCHAR PRIMARY KEY,
zone VARCHAR REFERENCES zone(nom),
NbreDeuxRouesCouvertes INTEGER NOT NULL,
NbreDeuxRouesAir INTEGER NOT NULL,
NbreCamionCouvertes INTEGER NOT NULL,
NbreCamionAir INTEGER NOT NULL,
NbreSimpleCouvertes INTEGER NOT NULL,
NbreSimpleAir INTEGER NOT NULL
NbrePlaces JSON
);
......@@ -96,9 +83,7 @@ prenom VARCHAR NOT NULL
CREATE TABLE abonnement (
num_abo INTEGER PRIMARY KEY,
prixAbonnement FLOAT NOT NULL,
duree INTEGER CHECK (duree>0) NOT NULL,
date_fin DATE NOT NULL,
infosAbo JSON,
parking VARCHAR REFERENCES parking(nom),
abonne INTEGER REFERENCES abonne(id)
);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment