forked from yassineJam/projetEPI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbase.sql
72 lines (63 loc) · 1.47 KB
/
base.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
CREATE TABLE EPI(
Id_epi INTEGER PRIMARY KEY AUTOINCREMENT,
TypeEpi TEXT,
NumSerie INT,
DateDeFabrication DATE,
DateAchat DATE,
DatePremiereUtilisation DATE,
DateMiseAuRebut DATE,
Modele TEXT,
DureeDeVie INT,
DureeUtilisation INT,
Marque TEXT,
Couleur TEXT,
NombreDansLeLot INT,
StatutLocation BOOLEAN,
MisEnService BOOLEAN,
RetraitEPI BOOLEAN,
MiseEnRebut BOOLEAN
);
CREATE TABLE Personne(
Id_personne INTEGER PRIMARY KEY AUTOINCREMENT,
Nom TEXT,
Prenom TEXT
);
CREATE TABLE Controleur(
Id_controleur INTEGER PRIMARY KEY AUTOINCREMENT,
Id_personne INT,
FOREIGN KEY(Id_personne) REFERENCES Personne(Id_personne)
);
CREATE TABLE Controle(
Id_controle INTEGER PRIMARY KEY AUTOINCREMENT,
TypeControle TEXT,
Analyse TEXT,
DateControle DATE,
Remarque TEXT,
Id_epi INT ,
Id_controleur INT,
FOREIGN KEY(Id_epi) REFERENCES EPI(Id_epi),
FOREIGN KEY(Id_controleur) REFERENCES Controleur(Id_controleur)
);
CREATE TABLE ContratLocation(
Id_contrat INTEGER PRIMARY KEY AUTOINCREMENT,
DateLocation DATE,
DateRetour DATE,
Remarque TEXT,
Id_personne INT,
Id_epi INT,
FOREIGN KEY(Id_personne) REFERENCES Personne(Id_personne),
FOREIGN KEY(Id_epi) REFERENCES EPI(Id_epi)
);
CREATE TABLE Mainteance(
NumMaintenance INTEGER PRIMARY KEY,
Id_epi INTEGER,
FOREIGN KEY(Id_epi) REFERENCES EPI(Id_personne)
);
CREATE TABLE TypeEPI(
Id_type INTEGER PRIMARY KEY AUTOINCREMENT,
TypeEPI TEXT
);
CREATE TABLE MarqueEPI(
Id_marque INTEGER PRIMARY KEY AUTOINCREMENT,
Marque TEXT
);