-- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Hôte : 127.0.0.1:3306
-- Généré le :  mar. 22 nov. 2022 à 20:57
-- Version du serveur :  5.7.19
-- Version de PHP :  5.6.31

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Base de données :  `bdd_ap1_2`
--

-- --------------------------------------------------------

--
-- Structure de la table `fonction`
--

DROP TABLE IF EXISTS `fonction`;
CREATE TABLE IF NOT EXISTS `fonction` (
  `IDFONCTION` int(11) NOT NULL AUTO_INCREMENT,
  `NOMFONCTION` varchar(150) NOT NULL,
  PRIMARY KEY (`IDFONCTION`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- --------------------------------------------------------

--
-- Structure de la table `incident`
--

DROP TABLE IF EXISTS `incident`;
CREATE TABLE IF NOT EXISTS `incident` (
  `IDINCIDENT` int(11) NOT NULL AUTO_INCREMENT,
  `NOMINCIDENT` varchar(150) NOT NULL,
  `DETAILINCIDENT` longtext NOT NULL,
  `NSERIEMAT` varchar(255) NOT NULL,
  PRIMARY KEY (`IDINCIDENT`),
  KEY `Incident_Materiel_FK` (`NSERIEMAT`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- --------------------------------------------------------

--
-- Structure de la table `materiel`
--

DROP TABLE IF EXISTS `materiel`;
CREATE TABLE IF NOT EXISTS `materiel` (
  `NSERIEMAT` varchar(255) NOT NULL,
  `NOMMAT` varchar(150) NOT NULL,
  PRIMARY KEY (`NSERIEMAT`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- --------------------------------------------------------

--
-- Structure de la table `salarie`
--

DROP TABLE IF EXISTS `salarie`;
CREATE TABLE IF NOT EXISTS `salarie` (
  `MATRICULESALARIE` varchar(150) NOT NULL,
  `NOMSALARIE` varchar(150) NOT NULL,
  `PRENOMSALARIE` varchar(150) NOT NULL,
  `TELSALARIE` varchar(20) NOT NULL,
  `MAILSALARIE` varchar(255) NOT NULL,
  `IDFONCTION` int(11) NOT NULL,
  PRIMARY KEY (`MATRICULESALARIE`),
  KEY `Salarie_Fonction_FK` (`IDFONCTION`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- --------------------------------------------------------

--
-- Structure de la table `signaler`
--

DROP TABLE IF EXISTS `signaler`;
CREATE TABLE IF NOT EXISTS `signaler` (
  `MATRICULESALARIE` varchar(150) NOT NULL,
  `IDINCIDENT` int(11) NOT NULL,
  `DATEDEBUTINCIDENT` date NOT NULL,
  `DATEFININCIDENT` date DEFAULT NULL,
  `OBSERVATION` longtext,
  `NIVEAUINCIDENT` int(11) NOT NULL,
  `STATUSINCIDENT` varchar(150) NOT NULL,
  PRIMARY KEY (`MATRICULESALARIE`,`IDINCIDENT`),
  KEY `Signaler_Incident0_FK` (`IDINCIDENT`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Contraintes pour les tables déchargées
--

--
-- Contraintes pour la table `incident`
--
ALTER TABLE `incident`
  ADD CONSTRAINT `Incident_Materiel_FK` FOREIGN KEY (`NSERIEMAT`) REFERENCES `materiel` (`NSERIEMAT`);

--
-- Contraintes pour la table `salarie`
--
ALTER TABLE `salarie`
  ADD CONSTRAINT `Salarie_Fonction_FK` FOREIGN KEY (`IDFONCTION`) REFERENCES `fonction` (`IDFONCTION`);

--
-- Contraintes pour la table `signaler`
--
ALTER TABLE `signaler`
  ADD CONSTRAINT `Signaler_Incident0_FK` FOREIGN KEY (`IDINCIDENT`) REFERENCES `incident` (`IDINCIDENT`),
  ADD CONSTRAINT `Signaler_Salarie_FK` FOREIGN KEY (`MATRICULESALARIE`) REFERENCES `salarie` (`MATRICULESALARIE`);
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
