Mise a jour du fichier .sql de la bdd
This commit is contained in:
parent
c81f131b56
commit
8ed2e14304
343
doc/bdd.sql
343
doc/bdd.sql
|
@ -1,81 +1,278 @@
|
|||
CREATE TABLE Etudes
|
||||
(
|
||||
idEtude INT(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
|
||||
intitule INT(11)
|
||||
);
|
||||
CREATE UNIQUE INDEX uindex_Etudes_idEtude ON Etudes (idEtude);
|
||||
-- phpMyAdmin SQL Dump
|
||||
-- version 4.4.13.1deb1
|
||||
-- http://www.phpmyadmin.net
|
||||
--
|
||||
-- Host: localhost
|
||||
-- Generation Time: Apr 10, 2016 at 12:22 PM
|
||||
-- Server version: 5.6.28-0ubuntu0.15.10.1
|
||||
-- PHP Version: 5.6.11-1ubuntu3.1
|
||||
|
||||
CREATE TABLE Questions
|
||||
(
|
||||
idQuestion INT(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
|
||||
intitule TEXT NOT NULL,
|
||||
qualification VARCHAR(255) NOT NULL,
|
||||
ihmType INT(11) NOT NULL,
|
||||
idEtude INT(11) NOT NULL,
|
||||
CONSTRAINT uindex_Question_idEtude FOREIGN KEY (idEtude) REFERENCES Etudes (idEtude)
|
||||
);
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
CREATE INDEX index_Question_idEtude ON Questions (idEtude);
|
||||
CREATE UNIQUE INDEX uindex_Questions_idQuestion ON Questions (idQuestion);
|
||||
|
||||
CREATE TABLE Personnes
|
||||
(
|
||||
idPersonne INT(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
|
||||
pseudo VARCHAR(255),
|
||||
nom VARCHAR(255),
|
||||
prenom VARCHAR(255)
|
||||
);
|
||||
CREATE UNIQUE INDEX uindex_Personnes_idPersonne ON Personnes (idPersonne);
|
||||
/*!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 */;
|
||||
|
||||
CREATE TABLE ReponsesAttendues
|
||||
(
|
||||
idReponseAttendue INT(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
|
||||
intitule VARCHAR(255) NOT NULL,
|
||||
idQuestion INT(11) NOT NULL,
|
||||
CONSTRAINT fk_ReponsesAttendues_idQuestion FOREIGN KEY (idQuestion) REFERENCES Questions (idQuestion)
|
||||
);
|
||||
CREATE INDEX index_ReponsesAttendues_idQuestion ON ReponsesAttendues (idQuestion);
|
||||
CREATE UNIQUE INDEX uindex_ReponsesAttendues_idReponseAttendue ON ReponsesAttendues (idReponseAttendue);
|
||||
--
|
||||
-- Database: `socioview`
|
||||
--
|
||||
|
||||
CREATE TABLE ReponsesUtilisateurs
|
||||
(
|
||||
idReponseUtilisateur INT(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
|
||||
intitule VARCHAR(255) NOT NULL,
|
||||
idQuestion INT(11) NOT NULL,
|
||||
idUtilisateur INT(11) NOT NULL,
|
||||
CONSTRAINT fk_ReponsesUtilisateurs FOREIGN KEY (idQuestion) REFERENCES Questions (idQuestion),
|
||||
CONSTRAINT fk_ReponsesUtilisateurs_idPersonne FOREIGN KEY (idUtilisateur) REFERENCES Personnes (idPersonne)
|
||||
);
|
||||
CREATE INDEX index_ReponsesUtilisateurs ON ReponsesUtilisateurs (idQuestion);
|
||||
CREATE INDEX index_ReponsesUtilisateurs_idPersonne ON ReponsesUtilisateurs (idUtilisateur);
|
||||
CREATE UNIQUE INDEX uindex_ReponsesUtilisateurs_idReponseUtilisateur ON ReponsesUtilisateurs (idReponseUtilisateur);
|
||||
-- --------------------------------------------------------
|
||||
|
||||
CREATE TABLE Categories
|
||||
(
|
||||
idCategorie INT(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
|
||||
intitule INT(11) NOT NULL
|
||||
);
|
||||
CREATE UNIQUE INDEX uindex_Catégories_idCatégorie ON Categories (idCategorie);
|
||||
--
|
||||
-- Table structure for table `Categories`
|
||||
--
|
||||
|
||||
CREATE TABLE Relations
|
||||
(
|
||||
idPersonneA INT(11) NOT NULL,
|
||||
idPersonneB INT(11) NOT NULL,
|
||||
idCategorie INT(11),
|
||||
CONSTRAINT `PRIMARY` PRIMARY KEY (idPersonneA, idPersonneB),
|
||||
CONSTRAINT fk_Relations_idCategorie FOREIGN KEY (idCategorie) REFERENCES Categories (idCategorie),
|
||||
CONSTRAINT fk_Relations_idUtilsateurA FOREIGN KEY (idPersonneA) REFERENCES Personnes (idPersonne),
|
||||
CONSTRAINT fk_Relations_idUtilsateurB FOREIGN KEY (idPersonneB) REFERENCES Personnes (idPersonne)
|
||||
);
|
||||
CREATE INDEX index_Relations_idCategorie ON Relations (idCategorie);
|
||||
CREATE INDEX index_Relations_idUtilsateurB ON Relations (idPersonneB);
|
||||
CREATE TABLE IF NOT EXISTS `Categories` (
|
||||
`idCategorie` int(11) NOT NULL,
|
||||
`intitule` varchar(32) NOT NULL
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
|
||||
|
||||
CREATE TABLE Etude_Personnes
|
||||
(
|
||||
idEtude INT(11) DEFAULT '0' NOT NULL,
|
||||
idPersonne INT(11) DEFAULT '0' NOT NULL,
|
||||
CONSTRAINT `PRIMARY` PRIMARY KEY (idEtude, idPersonne),
|
||||
CONSTRAINT fk_EP_idEtude FOREIGN KEY (idEtude) REFERENCES Etudes (idEtude),
|
||||
CONSTRAINT fk_EP_idPersonne FOREIGN KEY (idPersonne) REFERENCES Personnes (idPersonne)
|
||||
);
|
||||
CREATE INDEX index_EP_idPersonne ON Etude_Personnes (idPersonne);
|
||||
--
|
||||
-- Dumping data for table `Categories`
|
||||
--
|
||||
|
||||
INSERT INTO `Categories` (`idCategorie`, `intitule`) VALUES
|
||||
(1, '_CALL'),
|
||||
(2, '_SMS'),
|
||||
(3, '_FACEBOOK'),
|
||||
(4, '_MESSENGER');
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `Etudes`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `Etudes` (
|
||||
`idEtude` int(11) NOT NULL,
|
||||
`intitule` int(11) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `Etude_Personnes`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `Etude_Personnes` (
|
||||
`idEtude` int(11) NOT NULL DEFAULT '0',
|
||||
`idPersonne` int(11) NOT NULL DEFAULT '0'
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `Personnes`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `Personnes` (
|
||||
`idPersonne` int(11) NOT NULL,
|
||||
`pseudo` varchar(255) DEFAULT NULL,
|
||||
`nom` varchar(255) DEFAULT NULL,
|
||||
`prenom` varchar(255) DEFAULT NULL,
|
||||
`id_facebook` int(11) DEFAULT NULL,
|
||||
`telephone` int(11) DEFAULT NULL
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
|
||||
|
||||
--
|
||||
-- Dumping data for table `Personnes`
|
||||
--
|
||||
|
||||
INSERT INTO `Personnes` (`idPersonne`, `pseudo`, `nom`, `prenom`, `id_facebook`, `telephone`) VALUES
|
||||
(1, 'Jeannot', '', 'Jean', NULL, NULL);
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `Questions`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `Questions` (
|
||||
`idQuestion` int(11) NOT NULL,
|
||||
`intitule` text NOT NULL,
|
||||
`qualification` varchar(255) NOT NULL,
|
||||
`ihmType` int(11) NOT NULL,
|
||||
`idEtude` int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `Relations`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `Relations` (
|
||||
`idPersonneA` int(11) NOT NULL,
|
||||
`idPersonneB` int(11) NOT NULL,
|
||||
`idCategorie` int(11) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `ReponsesAttendues`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `ReponsesAttendues` (
|
||||
`idReponseAttendue` int(11) NOT NULL,
|
||||
`intitule` varchar(255) NOT NULL,
|
||||
`idQuestion` int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `ReponsesUtilisateurs`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `ReponsesUtilisateurs` (
|
||||
`idReponseUtilisateur` int(11) NOT NULL,
|
||||
`intitule` varchar(255) NOT NULL,
|
||||
`idQuestion` int(11) NOT NULL,
|
||||
`idUtilisateur` int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
--
|
||||
-- Indexes for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- Indexes for table `Categories`
|
||||
--
|
||||
ALTER TABLE `Categories`
|
||||
ADD PRIMARY KEY (`idCategorie`),
|
||||
ADD UNIQUE KEY `uindex_Catégories_idCatégorie` (`idCategorie`);
|
||||
|
||||
--
|
||||
-- Indexes for table `Etudes`
|
||||
--
|
||||
ALTER TABLE `Etudes`
|
||||
ADD PRIMARY KEY (`idEtude`),
|
||||
ADD UNIQUE KEY `uindex_Etudes_idEtude` (`idEtude`);
|
||||
|
||||
--
|
||||
-- Indexes for table `Etude_Personnes`
|
||||
--
|
||||
ALTER TABLE `Etude_Personnes`
|
||||
ADD PRIMARY KEY (`idEtude`,`idPersonne`),
|
||||
ADD KEY `index_EP_idPersonne` (`idPersonne`);
|
||||
|
||||
--
|
||||
-- Indexes for table `Personnes`
|
||||
--
|
||||
ALTER TABLE `Personnes`
|
||||
ADD PRIMARY KEY (`idPersonne`),
|
||||
ADD UNIQUE KEY `uindex_Personnes_idPersonne` (`idPersonne`);
|
||||
|
||||
--
|
||||
-- Indexes for table `Questions`
|
||||
--
|
||||
ALTER TABLE `Questions`
|
||||
ADD PRIMARY KEY (`idQuestion`),
|
||||
ADD UNIQUE KEY `uindex_Questions_idQuestion` (`idQuestion`),
|
||||
ADD KEY `index_Question_idEtude` (`idEtude`);
|
||||
|
||||
--
|
||||
-- Indexes for table `Relations`
|
||||
--
|
||||
ALTER TABLE `Relations`
|
||||
ADD PRIMARY KEY (`idPersonneA`,`idPersonneB`),
|
||||
ADD KEY `index_Relations_idCategorie` (`idCategorie`),
|
||||
ADD KEY `index_Relations_idUtilsateurB` (`idPersonneB`);
|
||||
|
||||
--
|
||||
-- Indexes for table `ReponsesAttendues`
|
||||
--
|
||||
ALTER TABLE `ReponsesAttendues`
|
||||
ADD PRIMARY KEY (`idReponseAttendue`),
|
||||
ADD UNIQUE KEY `uindex_ReponsesAttendues_idReponseAttendue` (`idReponseAttendue`),
|
||||
ADD KEY `index_ReponsesAttendues_idQuestion` (`idQuestion`);
|
||||
|
||||
--
|
||||
-- Indexes for table `ReponsesUtilisateurs`
|
||||
--
|
||||
ALTER TABLE `ReponsesUtilisateurs`
|
||||
ADD PRIMARY KEY (`idReponseUtilisateur`),
|
||||
ADD UNIQUE KEY `uindex_ReponsesUtilisateurs_idReponseUtilisateur` (`idReponseUtilisateur`),
|
||||
ADD KEY `index_ReponsesUtilisateurs` (`idQuestion`),
|
||||
ADD KEY `index_ReponsesUtilisateurs_idPersonne` (`idUtilisateur`);
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `Categories`
|
||||
--
|
||||
ALTER TABLE `Categories`
|
||||
MODIFY `idCategorie` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=5;
|
||||
--
|
||||
-- AUTO_INCREMENT for table `Etudes`
|
||||
--
|
||||
ALTER TABLE `Etudes`
|
||||
MODIFY `idEtude` int(11) NOT NULL AUTO_INCREMENT;
|
||||
--
|
||||
-- AUTO_INCREMENT for table `Personnes`
|
||||
--
|
||||
ALTER TABLE `Personnes`
|
||||
MODIFY `idPersonne` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
|
||||
--
|
||||
-- AUTO_INCREMENT for table `Questions`
|
||||
--
|
||||
ALTER TABLE `Questions`
|
||||
MODIFY `idQuestion` int(11) NOT NULL AUTO_INCREMENT;
|
||||
--
|
||||
-- AUTO_INCREMENT for table `ReponsesAttendues`
|
||||
--
|
||||
ALTER TABLE `ReponsesAttendues`
|
||||
MODIFY `idReponseAttendue` int(11) NOT NULL AUTO_INCREMENT;
|
||||
--
|
||||
-- AUTO_INCREMENT for table `ReponsesUtilisateurs`
|
||||
--
|
||||
ALTER TABLE `ReponsesUtilisateurs`
|
||||
MODIFY `idReponseUtilisateur` int(11) NOT NULL AUTO_INCREMENT;
|
||||
--
|
||||
-- Constraints for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- Constraints for table `Etude_Personnes`
|
||||
--
|
||||
ALTER TABLE `Etude_Personnes`
|
||||
ADD CONSTRAINT `fk_EP_idEtude` FOREIGN KEY (`idEtude`) REFERENCES `Etudes` (`idEtude`),
|
||||
ADD CONSTRAINT `fk_EP_idPersonne` FOREIGN KEY (`idPersonne`) REFERENCES `Personnes` (`idPersonne`);
|
||||
|
||||
--
|
||||
-- Constraints for table `Questions`
|
||||
--
|
||||
ALTER TABLE `Questions`
|
||||
ADD CONSTRAINT `uindex_Question_idEtude` FOREIGN KEY (`idEtude`) REFERENCES `Etudes` (`idEtude`);
|
||||
|
||||
--
|
||||
-- Constraints for table `Relations`
|
||||
--
|
||||
ALTER TABLE `Relations`
|
||||
ADD CONSTRAINT `fk_Relations_idCategorie` FOREIGN KEY (`idCategorie`) REFERENCES `Categories` (`idCategorie`),
|
||||
ADD CONSTRAINT `fk_Relations_idUtilsateurA` FOREIGN KEY (`idPersonneA`) REFERENCES `Personnes` (`idPersonne`),
|
||||
ADD CONSTRAINT `fk_Relations_idUtilsateurB` FOREIGN KEY (`idPersonneB`) REFERENCES `Personnes` (`idPersonne`);
|
||||
|
||||
--
|
||||
-- Constraints for table `ReponsesAttendues`
|
||||
--
|
||||
ALTER TABLE `ReponsesAttendues`
|
||||
ADD CONSTRAINT `fk_ReponsesAttendues_idQuestion` FOREIGN KEY (`idQuestion`) REFERENCES `Questions` (`idQuestion`);
|
||||
|
||||
--
|
||||
-- Constraints for table `ReponsesUtilisateurs`
|
||||
--
|
||||
ALTER TABLE `ReponsesUtilisateurs`
|
||||
ADD CONSTRAINT `fk_ReponsesUtilisateurs` FOREIGN KEY (`idQuestion`) REFERENCES `Questions` (`idQuestion`),
|
||||
ADD CONSTRAINT `fk_ReponsesUtilisateurs_idPersonne` FOREIGN KEY (`idUtilisateur`) REFERENCES `Personnes` (`idPersonne`);
|
||||
|
||||
/*!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 */;
|
Loading…
Reference in New Issue