NxTIC/doc/bdd.sql

389 lines
10 KiB
SQL

-- phpMyAdmin SQL Dump
-- version 4.4.13.1deb1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Apr 19, 2016 at 03:36 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,
`permission` text NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=61 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `api_token`
--
INSERT INTO `api_token` (`id_token`, `token`, `name`, `expires`, `permission`) VALUES
(38, '48e701d4e72e4e35bc37c9a800b49d5400734d7b', 'test', '2016-04-11', 'admin,token'),
(51, '52945efbed43b50c12413f2f0e9519bfd9e98ce8', 'API', '2016-04-24', 'token,admin');
-- --------------------------------------------------------
--
-- Table structure for table `call_directory`
--
CREATE TABLE IF NOT EXISTS `call_directory` (
`id_call_directory` int(11) NOT NULL,
`id_owner` int(11) NOT NULL,
`number` varchar(10) NOT NULL,
`name` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `call_logs`
--
CREATE TABLE IF NOT EXISTS `call_logs` (
`id_call_log` int(11) NOT NULL,
`source` varchar(10) NOT NULL,
`target` varchar(10) NOT NULL,
`type` varchar(5) NOT NULL,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`duration` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- 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 `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 `sujets`
--
CREATE TABLE IF NOT EXISTS `sujets` (
`idSujet` 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 `sujets`
--
INSERT INTO `sujets` (`idSujet`, `pseudo`, `nom`, `prenom`, `id_facebook`, `telephone`) VALUES
(1, 'Jeannot', '', 'Jean', NULL, NULL);
-- --------------------------------------------------------
--
-- 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(50) NOT NULL,
`reference` int(11) DEFAULT NULL,
`permission` text NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id_user`, `login`, `password`, `mail`, `reference`, `permission`) VALUES
(1, 'xdrm', 'fa80b2513864bbc9edd3ef52a9b6f29af3993768', 'xdrm@xdrm.io', NULL, 'admin'),
(11, 'julien.figeac', 'b5f2c48f299dabcf32e044ea6f2243abce812c55', 'julien.figeac@gmail.com', NULL, 'admin'),
(12, 'Buser', 'fa80b2513864bbc9edd3ef52a9b6f29af3993768', 'B@gmail.com', NULL, 'subject');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `api_token`
--
ALTER TABLE `api_token`
ADD PRIMARY KEY (`id_token`);
--
-- Indexes for table `call_logs`
--
ALTER TABLE `call_logs`
ADD PRIMARY KEY (`id_call_log`);
--
-- 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 `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 `sujets`
--
ALTER TABLE `sujets`
ADD PRIMARY KEY (`idSujet`),
ADD UNIQUE KEY `uindex_Personnes_idPersonne` (`idSujet`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id_user`),
ADD UNIQUE KEY `login` (`login`),
ADD UNIQUE KEY `mail` (`mail`),
ADD UNIQUE KEY `reference` (`reference`);
--
-- 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=61;
--
-- AUTO_INCREMENT for table `call_logs`
--
ALTER TABLE `call_logs`
MODIFY `id_call_log` int(11) NOT NULL AUTO_INCREMENT;
--
-- 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 `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 `sujets`
--
ALTER TABLE `sujets`
MODIFY `idSujet` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id_user` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=17;
--
-- 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 `sujets` (`idSujet`);
--
-- 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 `sujets` (`idSujet`),
ADD CONSTRAINT `fk_Relations_idUtilsateurB` FOREIGN KEY (`idPersonneB`) REFERENCES `sujets` (`idSujet`);
--
-- 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 `sujets` (`idSujet`);
/*!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 */;