· 9 years ago · Dec 14, 2016, 03:04 PM
1--
2-- Structure de la table 'depot'
3--
4
5DROP TABLE IF EXISTS Depot;
6CREATE TABLE IF NOT EXISTS Depot (
7 idDepot int(11) NOT NULL,
8 tailleDepot float NOT NULL,
9 PRIMARY KEY (idDepot)
10) ENGINE=InnoDB DEFAULT CHARSET=utf8;
11
12 -- --------------------------------------------------------
13
14--
15-- Structure de la table 'commit'
16--
17
18DROP TABLE IF EXISTS Commit;
19CREATE TABLE IF NOT EXISTS Commit (
20 idCommit int(11) NOT NULL,
21 dateCommit date NOT NULL,
22 descCommit varchar(500) DEFAULT NULL,
23 idTag int(11) DEFAULT NULL,
24 loginUtilisateur varchar(8) NOT NULL,
25 idBranche int(11) NOT NULL,
26 PRIMARY KEY (idCommit),
27 KEY FK_CommitTag(idTag),
28 KEY FK_CommitLogin(loginUtilisateur),
29 KEY FK_CommitBranche(idBranche)
30) ENGINE=InnoDB DEFAULT CHARSET=utf8;
31
32--
33-- Contraintes pour la table commit
34--
35ALTER TABLE Commit
36 ADD CONSTRAINT FK_CommitTag FOREIGN KEY (idTag) REFERENCES Tag (idTag),
37 ADD CONSTRAINT FK_CommitLogin FOREIGN KEY (loginUtilisateur) REFERENCES Utilisateur (loginUtilisateur),
38 ADD CONSTRAINT FK_CommitBranche FOREIGN KEY (idBranche) REFERENCES Branche (idBranche);
39
40 -- --------------------------------------------------------
41
42--
43-- Structure de la table 'appartenir'
44--
45
46DROP TABLE IF EXISTS Appartenir;
47CREATE TABLE IF NOT EXISTS Appartenir (
48 loginUtilisateur varchar(8) NOT NULL,
49 idDepot int(11) NOT NULL,
50 typeUtilisateur int(1) NOT NULL,
51 UrlDepot varchar(100) NOT NULL,
52 PRIMARY KEY (loginUtilisateur, idDepot),
53 KEY FK_AppartenirLogin(loginUtilisateur),
54 KEY FK_AppartenirDepot(idDepot)
55) ENGINE=InnoDB DEFAULT CHARSET=utf8;
56
57ALTER TABLE Appartenir
58 ADD CONSTRAINT FK_AppartenirLogin FOREIGN KEY (loginUtilisateur) REFERENCES Utilisateur (loginUtilisateur),
59 ADD CONSTRAINT FK_AppartenirDepot FOREIGN KEY (idDepot) REFERENCES Depot (idDepot);