|
|
|
@ -14,7 +14,7 @@ CREATE TABLE IF NOT EXISTS BusinessUnit( |
|
|
|
|
Id int NOT NULL AUTO_INCREMENT, |
|
|
|
|
Name varchar(100) NOT NULL UNIQUE, |
|
|
|
|
AgenceId int NOT NULL, |
|
|
|
|
CONSTRAINT FK_BUSINESS_UNIT_AGENCE FOREIGN KEY (AgenceId) references agence(Id), |
|
|
|
|
CONSTRAINT FK_BUSINESS_UNIT_AGENCE FOREIGN KEY (AgenceId) references Agence(Id), |
|
|
|
|
PRIMARY KEY (Id) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
@ -24,7 +24,7 @@ CREATE TABLE IF NOT EXISTS Site( |
|
|
|
|
Name varchar(100) NOT NULL UNIQUE, |
|
|
|
|
Address varchar(200) NOT NULL, |
|
|
|
|
BusinessUnitId int NOT NULL, |
|
|
|
|
CONSTRAINT FK_SITE_BUSINESS_UNIT FOREIGN KEY (BusinessUnitId) references business_unit(Id), |
|
|
|
|
CONSTRAINT FK_SITE_BUSINESS_UNIT FOREIGN KEY (BusinessUnitId) references BusinessUnit(Id), |
|
|
|
|
PRIMARY KEY (Id) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
@ -81,7 +81,7 @@ CREATE TABLE IF NOT EXISTS Collaborateur( |
|
|
|
|
ApsideMail varchar(100) NOT NULL, |
|
|
|
|
ResignationDate date NOT NULL, |
|
|
|
|
ReferrerId int NOT NULL, |
|
|
|
|
CONSTRAINT FK_COLLABORATEUR_PARRAIN FOREIGN KEY (ReferrerId) REFERENCES collaborateur(Id), |
|
|
|
|
CONSTRAINT FK_COLLABORATEUR_PARRAIN FOREIGN KEY (ReferrerId) REFERENCES Collaborateur(Id), |
|
|
|
|
PRIMARY KEY (Id) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
@ -92,8 +92,8 @@ CREATE TABLE IF NOT EXISTS Referencement( |
|
|
|
|
EndingDate date NOT NULL, |
|
|
|
|
ReferredId int NOT NULL, |
|
|
|
|
ReferrerId int NOT NULL, |
|
|
|
|
CONSTRAINT FK_COLLABORATEUR_REFERE FOREIGN KEY (ReferredId) REFERENCES collaborateur(Id), |
|
|
|
|
CONSTRAINT FK_COLLABORATEUR_REFERENT FOREIGN KEY (ReferrerId) REFERENCES collaborateur(Id), |
|
|
|
|
CONSTRAINT FK_COLLABORATEUR_REFERE FOREIGN KEY (ReferredId) REFERENCES Collaborateur(Id), |
|
|
|
|
CONSTRAINT FK_COLLABORATEUR_REFERENT FOREIGN KEY (ReferrerId) REFERENCES Collaborateur(Id), |
|
|
|
|
PRIMARY KEY (Id) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
@ -102,8 +102,8 @@ CREATE TABLE IF NOT EXISTS CollaborateurEstFonction( |
|
|
|
|
CollaborateurId int NOT NULL, |
|
|
|
|
FonctionId int NOT NULL, |
|
|
|
|
PRIMARY KEY (CollaborateurId,FonctionId), |
|
|
|
|
CONSTRAINT FK_COLLABORATEUR_FONCTION FOREIGN KEY (CollaborateurId) REFERENCES collaborateur(Id), |
|
|
|
|
CONSTRAINT FK_FONCTION_COLLABORATEUR FOREIGN KEY (FonctionId) REFERENCES fonction(Id) |
|
|
|
|
CONSTRAINT FK_COLLABORATEUR_FONCTION FOREIGN KEY (CollaborateurId) REFERENCES Collaborateur(Id), |
|
|
|
|
CONSTRAINT FK_FONCTION_COLLABORATEUR FOREIGN KEY (FonctionId) REFERENCES Fonction(Id) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
DROP TABLE IF EXISTS CollaborateurAppartientBusinessUnit; |
|
|
|
@ -111,8 +111,8 @@ CREATE TABLE IF NOT EXISTS CollaborateurAppartientBusinessUnit( |
|
|
|
|
CollaborateurId int NOT NULL, |
|
|
|
|
BusinessUnitId int NOT NULL, |
|
|
|
|
PRIMARY KEY (CollaborateurId,BusinessUnitId), |
|
|
|
|
CONSTRAINT FK_COLLABORATEUR_BUSINESS_UNIT FOREIGN KEY (CollaborateurId) REFERENCES collaborateur(Id), |
|
|
|
|
CONSTRAINT FK_BUSINESS_UNIT_COLLABORATEUR FOREIGN KEY (BusinessUnitId) REFERENCES business_unit(Id) |
|
|
|
|
CONSTRAINT FK_COLLABORATEUR_BUSINESS_UNIT FOREIGN KEY (CollaborateurId) REFERENCES Collaborateur(Id), |
|
|
|
|
CONSTRAINT FK_BUSINESS_UNIT_COLLABORATEUR FOREIGN KEY (BusinessUnitId) REFERENCES BusinessUnit(Id) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
DROP TABLE IF EXISTS CollaborateurEffectuePeriodeEssai; |
|
|
|
@ -120,8 +120,8 @@ CREATE TABLE IF NOT EXISTS CollaborateurEffectuePeriodeEssai( |
|
|
|
|
CollaborateurId int NOT NULL, |
|
|
|
|
PeriodeEssaiId int NOT NULL, |
|
|
|
|
PRIMARY KEY (CollaborateurId,PeriodeEssaiId), |
|
|
|
|
CONSTRAINT FK_COLLABORATEUR_PERIODE_ESSAI FOREIGN KEY (CollaborateurId) REFERENCES collaborateur(Id), |
|
|
|
|
CONSTRAINT FK_PERIODE_ESSAI_COLLABORATEUR FOREIGN KEY (PeriodeEssaiId) REFERENCES periode_essai(Id) |
|
|
|
|
CONSTRAINT FK_COLLABORATEUR_PERIODE_ESSAI FOREIGN KEY (CollaborateurId) REFERENCES Collaborateur(Id), |
|
|
|
|
CONSTRAINT FK_PERIODE_ESSAI_COLLABORATEUR FOREIGN KEY (PeriodeEssaiId) REFERENCES BusinessUnit(Id) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
DROP TABLE IF EXISTS SiteDeveloppeProjet; |
|
|
|
@ -129,8 +129,8 @@ CREATE TABLE IF NOT EXISTS SiteDeveloppeProjet( |
|
|
|
|
SiteId int NOT NULL, |
|
|
|
|
ProjetId int NOT NULL, |
|
|
|
|
PRIMARY KEY (SiteId,ProjetId), |
|
|
|
|
CONSTRAINT FK_SITE_PROJET FOREIGN KEY (SiteId) REFERENCES site(Id), |
|
|
|
|
CONSTRAINT FK_PROJET_SITE FOREIGN KEY (ProjetId) REFERENCES projet(Id) |
|
|
|
|
CONSTRAINT FK_SITE_PROJET FOREIGN KEY (SiteId) REFERENCES Site(Id), |
|
|
|
|
CONSTRAINT FK_PROJET_SITE FOREIGN KEY (ProjetId) REFERENCES Projet(Id) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
DROP TABLE IF EXISTS ProjetUtiliseTechnologie; |
|
|
|
@ -138,8 +138,8 @@ CREATE TABLE IF NOT EXISTS ProjetUtiliseTechnologie( |
|
|
|
|
ProjetId int NOT NULL, |
|
|
|
|
TechnologieId int NOT NULL, |
|
|
|
|
PRIMARY KEY (ProjetId,TechnologieId), |
|
|
|
|
CONSTRAINT FK_PROJET_TECHNOLOGIE FOREIGN KEY (ProjetId) REFERENCES projet(Id), |
|
|
|
|
CONSTRAINT FK_TECHNOLOGIE_PROJET FOREIGN KEY (TechnologieId) REFERENCES technologie(Id) |
|
|
|
|
CONSTRAINT FK_PROJET_TECHNOLOGIE FOREIGN KEY (ProjetId) REFERENCES Projet(Id), |
|
|
|
|
CONSTRAINT FK_TECHNOLOGIE_PROJET FOREIGN KEY (TechnologieId) REFERENCES Technologie(Id) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
DROP TABLE IF EXISTS CollaborateurCollaboreProjet; |
|
|
|
@ -148,6 +148,6 @@ CREATE TABLE IF NOT EXISTS CollaborateurCollaboreProjet( |
|
|
|
|
ProjetId int NOT NULL, |
|
|
|
|
isManager boolean NOT NULL, |
|
|
|
|
PRIMARY KEY (CollaborateurId,ProjetId), |
|
|
|
|
CONSTRAINT FK_COLLABORATEUR_COLLABORE_PROJET FOREIGN KEY (CollaborateurId) REFERENCES collaborateur(Id), |
|
|
|
|
CONSTRAINT FK_PROJET_COLLABORE_COLLABORATEUR FOREIGN KEY (ProjetId) REFERENCES projet(Id) |
|
|
|
|
CONSTRAINT FK_COLLABORATEUR_COLLABORE_PROJET FOREIGN KEY (CollaborateurId) REFERENCES Collaborateur(Id), |
|
|
|
|
CONSTRAINT FK_PROJET_COLLABORE_COLLABORATEUR FOREIGN KEY (ProjetId) REFERENCES Projet(Id) |
|
|
|
|
); |
|
|
|
|