NxTIC/doc/bdd.sql

345 lines
9.2 KiB
SQL

-- phpMyAdmin SQL Dump
-- version 4.4.13.1deb1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Apr 12, 2016 at 05:32 PM
-- Server version: 5.6.28-0ubuntu0.15.10.1
-- PHP Version: 5.6.11-1ubuntu3.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
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 */;
--
-- Database: `socioview`
--
-- --------------------------------------------------------
--
-- Table structure for table `api_token`
--
CREATE TABLE IF NOT EXISTS `api_token` (
`id_token` int(11) NOT NULL,
`token` varchar(40) NOT NULL,
`name` varchar(50) NOT NULL,
`expires` date NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=49 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `api_token`
--
INSERT INTO `api_token` (`id_token`, `token`, `name`, `expires`) VALUES
(38, '48e701d4e72e4e35bc37c9a800b49d5400734d7b', 'test', '2016-04-11'),
(39, '935fe104d0e64d36e466c7a0a1c9773e3d7521c5', 'user#1', '2016-04-22'),
(48, 'bba06e9b01f5ac00798d6cf241d8bf105da0f25a', 'user#2', '2016-05-02');
-- --------------------------------------------------------
--
-- Table structure for table `Categories`
--
CREATE TABLE IF NOT EXISTS `Categories` (
`idCategorie` int(11) NOT NULL,
`intitule` varchar(40) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
--
-- 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` varchar(10) 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;
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE IF NOT EXISTS `users` (
`id_user` int(11) NOT NULL,
`login` varchar(30) NOT NULL,
`password` varchar(40) NOT NULL,
`mail` varchar(255) NOT NULL,
`reference` int(11) DEFAULT NULL,
`permission` text NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id_user`, `login`, `password`, `mail`, `reference`, `permission`) VALUES
(1, 'xdrm', '5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8', 'xdrm@xdrm.io', NULL, 'admin,user');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `api_token`
--
ALTER TABLE `api_token`
ADD PRIMARY KEY (`id_token`);
--
-- 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`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id_user`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `api_token`
--
ALTER TABLE `api_token`
MODIFY `id_token` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=49;
--
-- 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;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id_user` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3;
--
-- 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 */;