parent
3812a18162
commit
ef5d596d43
@ -0,0 +1,161 @@ |
||||
DROP DATABASE IF EXISTS collaborateur_epa; |
||||
CREATE DATABASE IF NOT EXISTS collaborateur_epa /*!40100 DEFAULT CHARACTER SET latin1 */; |
||||
USE collaborateur_epa; |
||||
|
||||
DROP TABLE IF EXISTS agence; |
||||
CREATE TABLE IF NOT EXISTS agence( |
||||
id int NOT NULL AUTO_INCREMENT, |
||||
nom varchar(100) NOT NULL UNIQUE, |
||||
adresse_id int NOT NULL, |
||||
PRIMARY KEY (id) |
||||
); |
||||
|
||||
DROP TABLE IF EXISTS business_unit; |
||||
CREATE TABLE IF NOT EXISTS business_unit( |
||||
id int NOT NULL AUTO_INCREMENT, |
||||
nom varchar(100) NOT NULL UNIQUE, |
||||
agence_id int NOT NULL, |
||||
CONSTRAINT FK_BUSINESS_UNIT_AGENCE FOREIGN KEY (agence_id) references agence(id), |
||||
PRIMARY KEY (id) |
||||
); |
||||
|
||||
DROP TABLE IF EXISTS site; |
||||
CREATE TABLE IF NOT EXISTS site( |
||||
id int NOT NULL AUTO_INCREMENT, |
||||
nom varchar(100) NOT NULL UNIQUE, |
||||
adresse varchar(200) NOT NULL, |
||||
business_unit_id int NOT NULL, |
||||
CONSTRAINT FK_SITE_BUSINESS_UNIT FOREIGN KEY (business_unit_id) references business_unit(id), |
||||
PRIMARY KEY (id) |
||||
); |
||||
|
||||
DROP TABLE IF EXISTS projet; |
||||
CREATE TABLE IF NOT EXISTS projet( |
||||
id int NOT NULL AUTO_INCREMENT, |
||||
nom varchar(100) NOT NULL UNIQUE, |
||||
client varchar(100) NOT NULL, |
||||
description varchar(100) NOT NULL, |
||||
date_debut date NOT NULL, |
||||
dateFin date NOT NULL, |
||||
PRIMARY KEY (id) |
||||
); |
||||
|
||||
DROP TABLE IF EXISTS technologie; |
||||
CREATE TABLE IF NOT EXISTS technologie( |
||||
id int NOT NULL UNIQUE, |
||||
intitule varchar(100) NOT NULL UNIQUE, |
||||
PRIMARY KEY (id) |
||||
); |
||||
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS periode_essai; |
||||
CREATE TABLE IF NOT EXISTS periode_essai( |
||||
id int NOT NULL AUTO_INCREMENT, |
||||
date_debut date NOT NULL, |
||||
date_fin_prevue date NOT NULL, |
||||
date_fin_effective date NOT NULL, |
||||
commentaire varchar(100), |
||||
issue ENUM('VALIDEE','PROLONGEE_COLLAB','PROLONGEE_APSIDE','ARRETEE_COLLAB','ARRETEE_APSIDE'), |
||||
PRIMARY KEY (id) |
||||
); |
||||
|
||||
DROP TABLE IF EXISTS fonction; |
||||
CREATE TABLE IF NOT EXISTS fonction( |
||||
id int NOT NULL UNIQUE, |
||||
intitule varchar(100) NOT NULL UNIQUE, |
||||
PRIMARY KEY (id) |
||||
); |
||||
|
||||
DROP TABLE IF EXISTS collaborateur; |
||||
CREATE TABLE IF NOT EXISTS collaborateur( |
||||
id int NOT NULL AUTO_INCREMENT, |
||||
nom varchar(100) NOT NULL UNIQUE, |
||||
prenom varchar(100) NOT NULL, |
||||
date_naissance date NOT NULL, |
||||
genre ENUM('MASCULIN','FEMININ','AUTRE'), |
||||
statut ENUM('CADRE','NON-CADRE','ALTERNANT','STAGIAIRE'), |
||||
nombre_enfants smallint, |
||||
telephone varchar(15), |
||||
mail_personnel varchar(100), |
||||
mail_apside varchar(100), |
||||
date_depart date, |
||||
parrain_id int, |
||||
CONSTRAINT FK_COLLABORATEUR_PARRAIN FOREIGN KEY (parrain_id) REFERENCES collaborateur(id), |
||||
PRIMARY KEY (id) |
||||
); |
||||
|
||||
DROP TABLE IF EXISTS referencement; |
||||
CREATE TABLE IF NOT EXISTS referencement( |
||||
id int NOT NULL AUTO_INCREMENT, |
||||
date_debut date NOT NULL, |
||||
date_fin date NOT NULL, |
||||
refere_id int NOT NULL, |
||||
referent_id int NOT NULL, |
||||
CONSTRAINT FK_COLLABORATEUR_REFERE FOREIGN KEY (refere_id) REFERENCES collaborateur(id), |
||||
CONSTRAINT FK_COLLABORATEUR_REFERENT FOREIGN KEY (referent_id) REFERENCES collaborateur(id), |
||||
PRIMARY KEY (id) |
||||
); |
||||
|
||||
DROP TABLE IF EXISTS collaborateur_est_fonction; |
||||
CREATE TABLE IF NOT EXISTS collaborateur_est_fonction( |
||||
collaborateur_id int NOT NULL, |
||||
fonction_id int NOT NULL, |
||||
PRIMARY KEY (collaborateur_id,fonction_id), |
||||
CONSTRAINT FK_COLLABORATEUR_FONCTION FOREIGN KEY (collaborateur_id) REFERENCES collaborateur(id), |
||||
CONSTRAINT FK_FONCTION_COLLABORATEUR FOREIGN KEY (fonction_id) REFERENCES fonction(id) |
||||
); |
||||
|
||||
DROP TABLE IF EXISTS collaborateur_appartient_business_unit; |
||||
CREATE TABLE IF NOT EXISTS collaborateur_appartient_business_unit( |
||||
collaborateur_id int NOT NULL, |
||||
business_unit_id int NOT NULL, |
||||
PRIMARY KEY (collaborateur_id,business_unit_id), |
||||
CONSTRAINT FK_COLLABORATEUR_BUSINESS_UNIT FOREIGN KEY (collaborateur_id) REFERENCES collaborateur(id), |
||||
CONSTRAINT FK_BUSINESS_UNIT_COLLABORATEUR FOREIGN KEY (business_unit_id) REFERENCES business_unit(id) |
||||
); |
||||
|
||||
DROP TABLE IF EXISTS collaborateur_effectue_periode_essai; |
||||
CREATE TABLE IF NOT EXISTS collaborateur_effectue_periode_essai( |
||||
collaborateur_id int NOT NULL, |
||||
periode_essai_id int NOT NULL, |
||||
PRIMARY KEY (collaborateur_id,periode_essai_id), |
||||
CONSTRAINT FK_COLLABORATEUR_PERIODE_ESSAI FOREIGN KEY (collaborateur_id) REFERENCES collaborateur(id), |
||||
CONSTRAINT FK_PERIODE_ESSAI_COLLABORATEUR FOREIGN KEY (periode_essai_id) REFERENCES periode_essai(id) |
||||
); |
||||
|
||||
DROP TABLE IF EXISTS site_developpe_projet; |
||||
CREATE TABLE IF NOT EXISTS site_developpe_projet( |
||||
site_id int NOT NULL, |
||||
projet_id int NOT NULL, |
||||
PRIMARY KEY (site_id,projet_id), |
||||
CONSTRAINT FK_SITE_PROJET FOREIGN KEY (site_id) REFERENCES site(id), |
||||
CONSTRAINT FK_PROJET_SITE FOREIGN KEY (projet_id) REFERENCES projet(id) |
||||
); |
||||
|
||||
DROP TABLE IF EXISTS projet_utilise_technologie; |
||||
CREATE TABLE IF NOT EXISTS projet_utilise_technologie( |
||||
projet_id int NOT NULL, |
||||
technologie_id int NOT NULL, |
||||
PRIMARY KEY (projet_id,technologie_id), |
||||
CONSTRAINT FK_PROJET_TECHNOLOGIE FOREIGN KEY (projet_id) REFERENCES projet(id), |
||||
CONSTRAINT FK_TECHNOLOGIE_PROJET FOREIGN KEY (technologie_id) REFERENCES technologie(id) |
||||
); |
||||
|
||||
DROP TABLE IF EXISTS collaborateur_manage_projet; |
||||
CREATE TABLE IF NOT EXISTS collaborateur_manage_projet( |
||||
collaborateur_id int NOT NULL, |
||||
projet_id int NOT NULL, |
||||
PRIMARY KEY (collaborateur_id,projet_id), |
||||
CONSTRAINT FK_COLLABORATEUR_MANAGE_PROJET FOREIGN KEY (collaborateur_id) REFERENCES collaborateur(id), |
||||
CONSTRAINT FK_PROJET_MANAGE_COLLABORATEUR FOREIGN KEY (projet_id) REFERENCES projet(id) |
||||
); |
||||
|
||||
DROP TABLE IF EXISTS collaborateur_collabore_projet; |
||||
CREATE TABLE IF NOT EXISTS collaborateur_collabore_projet( |
||||
collaborateur_id int NOT NULL, |
||||
projet_id int NOT NULL, |
||||
PRIMARY KEY (collaborateur_id,projet_id), |
||||
CONSTRAINT FK_COLLABORATEUR_COLLABORE_PROJET FOREIGN KEY (collaborateur_id) REFERENCES collaborateur(id), |
||||
CONSTRAINT FK_PROJET_COLLABORE_COLLABORATEUR FOREIGN KEY (projet_id) REFERENCES projet(id) |
||||
); |
Loading…
Reference in new issue