-- phpMyAdmin SQL Dump!
-- version 4.1.3!
-- http://www.phpmyadmin.net!
--!
-- Client : localhost!
-- Généré le : Lun 19 Mai 2014 à 15:06!
-- Version du serveur : 5.6.15!
-- Version de PHP : 5.4.24!
!
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 utf8 */;!
!
--!-- Base de données : `cte`!
--!
!
-- ---!
!
--!-- Structure de la table `homeworks`!
--!
!
CREATE TABLE IF NOT EXISTS `homeworks` (!
`id` int(11) NOT NULL AUTO_INCREMENT,!
`created` datetime DEFAULT NULL,!
`end` datetime DEFAULT NULL,!
`content` longtext,!
`unit_id` int(11) NOT NULL,!
`promotion_id` int(11) NOT NULL,!
PRIMARY KEY (`id`),!
KEY `fk_homeworks_units_idx` (`unit_id`),!
KEY `fk_homeworks_promotions1_idx` (`promotion_id`)!
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;!
!
--!-- Contenu de la table `homeworks`!
--!
!
INSERT INTO `homeworks` (`id`, `created`, `end`, `content`, `unit_id`, `promotion_id`) VALUES!
(1, '2014-04-30 12:05:16', '2014-05-06 06:33:00', 'fonctions sql à intégrées', 3, 1),!
(2, '2014-05-06 06:52:41', '2014-05-15 06:52:00', 'Faire un cv', 2, 1);!
!
-- ---!!
--!-- Structure de la table `interventions`!
--!
!
CREATE TABLE IF NOT EXISTS `interventions` (!
`id` int(11) NOT NULL AUTO_INCREMENT,!
`dateIntervention` datetime DEFAULT NULL,!
`duration` decimal(10,0) DEFAULT NULL,!
`contents` longtext,!
`label` varchar(255) DEFAULT NULL,!
`ip` varchar(255) DEFAULT NULL,!
`unit_id` int(11) NOT NULL,!
`promotion_id` int(11) NOT NULL,!
`user_id` int(11) NOT NULL,!
PRIMARY KEY (`id`),!
KEY `fk_interventions_units1_idx` (`unit_id`),!
KEY `fk_interventions_promotions1_idx` (`promotion_id`),!
KEY `fk_interventions_users1_idx` (`user_id`)!
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=9 ;!
!
--!-- Contenu de la table `interventions`!
--!
!
INSERT INTO `interventions` (`id`, `dateIntervention`, `duration`, `contents`, `label`, `ip`, `unit_id`,
`promotion_id`, `user_id`) VALUES!
(1, '2014-05-06 06:37:00', '4', 'Préparation d''un CV en anglais et d''une lettre de motivation.', 'CV &
Lettre de motivation', '::1', 2, 1, 1),!
(2, '2014-05-06 06:31:00', '1', 'Cours sur les suites puis exercices', 'Chapitre 3 : Les suites numériques', '::1', 3, 1, 24),!
(4, '2014-05-06 07:45:00', '1', 'Exercices dans le livre p234', 'Equation différentielle', '::1', 2, 1, 24),!
(5, '2014-05-06 07:46:00', '2', 'Exercices de la page 123', 'Probabilités', '::1', 2, 1, 24),!
(6, '2014-05-03 14:46:00', '4', 'Exercice d''algorithme', 'Algorithme', '::1', 2, 1, 24),!
(7, '2014-03-07 12:47:00', '4', 'Découverte de la moyenne, médiane et écart type.', 'Statistiques', '::
1', 2, 1, 24),!
(8, '2014-05-06 08:01:00', '4', 'Présentation du cte', 'CTE', '::1', 2, 1, 24);!
!
-- ---!!
--!-- Structure de la table `programs`!
--!
!
CREATE TABLE IF NOT EXISTS `programs` (!
`id` int(11) NOT NULL AUTO_INCREMENT,!
`date` date DEFAULT NULL,!
`url` text,!
`unit_id` int(11) NOT NULL,!
PRIMARY KEY (`id`),!
KEY `fk_programs_units1_idx` (`unit_id`)!
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;!
!
--!-- Contenu de la table `programs`!
--!
!
INSERT INTO `programs` (`id`, `date`, `url`, `unit_id`) VALUES!
(2, '2014-05-06', 'Syllabus/D43protecBDD.pdf', 2);!
!
-- ---!!
--!-- Structure de la table `promotions`!
--!
!
CREATE TABLE IF NOT EXISTS `promotions` (!
`id` int(11) NOT NULL AUTO_INCREMENT,!
`name` varchar(255) DEFAULT NULL,!
`promotion_type_id` int(11) NOT NULL,!
PRIMARY KEY (`id`),!
KEY `fk_promotions_promotion_types1_idx` (`promotion_type_id`)!
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;!
!
--!-- Contenu de la table `promotions`!
--!
!
INSERT INTO `promotions` (`id`, `name`, `promotion_type_id`) VALUES!
(1, 'B11', 1),!
(2, 'B2', 2);!
!
-- ---!!
--!-- Structure de la table `promotion_types`!
--!
!
CREATE TABLE IF NOT EXISTS `promotion_types` (!
`id` int(11) NOT NULL AUTO_INCREMENT,!
`label` varchar(255) DEFAULT NULL,!
PRIMARY KEY (`id`)!
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;!
!
--!-- Contenu de la table `promotion_types`!
--!
!
INSERT INTO `promotion_types` (`id`, `label`) VALUES!
(1, 'Alternant'),!
(2, 'Initiaux');!
!
-- ---!!
--!-- Structure de la table `tests`!
--!
!
CREATE TABLE IF NOT EXISTS `tests` (!
`id` int(11) NOT NULL AUTO_INCREMENT,!
`contents` longtext,!
`date` date DEFAULT NULL,!
`correction` tinyint(1) DEFAULT NULL,!
`url` text,!
`intervention_id` int(11) NOT NULL,!
`test_type_id` int(11) NOT NULL,!
PRIMARY KEY (`id`),!
KEY `fk_tests_interventions1_idx` (`intervention_id`),!
KEY `fk_tests_test_types1_idx` (`test_type_id`)!
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;!
!
--!-- Contenu de la table `tests`!
--!
!
INSERT INTO `tests` (`id`, `contents`, `date`, `correction`, `url`, `intervention_id`, `test_type_id`) VALUES!
(1, 'Evaluation\r\n\r\nRésoudre la fonction Un=x+y-z', '2014-04-30', 1, '', 2, 2);!
!
-- ---!!
--!-- Structure de la table `test_types`!
--!
!
CREATE TABLE IF NOT EXISTS `test_types` (!
`id` int(11) NOT NULL AUTO_INCREMENT,!
`label` varchar(255) DEFAULT NULL,!
PRIMARY KEY (`id`)!
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;!
!
--!-- Contenu de la table `test_types`!
--!
!
INSERT INTO `test_types` (`id`, `label`) VALUES!
(1, 'Partiel'),!
(2, 'Controle');!
!
-- ---!!
--!-- Structure de la table `units`!
--!
!
CREATE TABLE IF NOT EXISTS `units` (!
`id` int(11) NOT NULL AUTO_INCREMENT,!
`label` varchar(255) DEFAULT NULL,!
PRIMARY KEY (`id`)!
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;!
!
--!-- Contenu de la table `units`!
--!
!
INSERT INTO `units` (`id`, `label`) VALUES!
(2, 'Anglais'),!
(3, 'Mathématiques');!
!
-- ---!!
--!-- Structure de la table `units_promotions`!
--!
!
CREATE TABLE IF NOT EXISTS `units_promotions` (!
`unit_id` int(11) NOT NULL,!
`promotion_id` int(11) NOT NULL,!
PRIMARY KEY (`unit_id`,`promotion_id`),!
KEY `fk_units_has_promotions_promotions1_idx` (`promotion_id`),!
KEY `fk_units_has_promotions_units1_idx` (`unit_id`)!
) ENGINE=InnoDB DEFAULT CHARSET=utf8;!
!
--!-- Contenu de la table `units_promotions`!
--!
!
INSERT INTO `units_promotions` (`unit_id`, `promotion_id`) VALUES!
(2, 1);!
!
-- ---!!
--!-- Structure de la table `users`!
--!
!
CREATE TABLE IF NOT EXISTS `users` (!
`id` int(11) NOT NULL AUTO_INCREMENT,!
`username` varchar(45) DEFAULT NULL,!
`password` varchar(255) DEFAULT NULL,!
`nom` varchar(255) DEFAULT NULL,!
`prenom` varchar(255) DEFAULT NULL,!
`admin` tinyint(1) NOT NULL DEFAULT '0',!
PRIMARY KEY (`id`)!
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=26 ;!
!
--!-- Contenu de la table `users`!
--!
!
INSERT INTO `users` (`id`, `username`, `password`, `nom`, `prenom`, `admin`) VALUES!
(1, 'anglais', 'b691b6aa9c5bf5fcaa782ebb77e2c3162fb6bfd5', 'Ferrand', 'Jean-Jacques', 0),!
(3, 'admin', 'd518f6ed16f4c3790bb806cd3242723af986c695', 'Alamasset', 'Eddie', 1),!
(22, 'tonton', 'd518f6ed16f4c3790bb806cd3242723af986c695', 'Ocre', 'Thierry', 0),!
(24, 'root', 'b691b6aa9c5bf5fcaa782ebb77e2c3162fb6bfd5', 'Pruvost', 'Benjamin', 0),!
(25, 'Lefbvre', '3c6bb6097296f3f65891e3f5d9963261f8284cb2', 'Lefebvre', 'Patrick', 0);!
!
-- ---!!
--!-- Structure de la table `users_units`!
--!
!
CREATE TABLE IF NOT EXISTS `users_units` (!
`user_id` int(11) NOT NULL,!
`unit_id` int(11) NOT NULL,!
PRIMARY KEY (`user_id`,`unit_id`),!
KEY `fk_users_has_units_units1_idx` (`unit_id`),!
KEY `fk_users_has_units_users1_idx` (`user_id`)!
) ENGINE=InnoDB DEFAULT CHARSET=utf8;!
!
--!
-- Contenu de la table `users_units`!
--!
!
INSERT INTO `users_units` (`user_id`, `unit_id`) VALUES!
(1, 2),!
(24, 2),!
(24, 3);!
!
--!-- Contraintes pour les tables exportées!
--!
!
--!
-- Contraintes pour la table `homeworks`!
--!
ALTER TABLE `homeworks`!
ADD CONSTRAINT `fk_homeworks_promotions1` FOREIGN KEY (`promotion_id`) REFERENCES `promotions` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,!
ADD CONSTRAINT `fk_homeworks_units` FOREIGN KEY (`unit_id`) REFERENCES `units` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;!
!
--!-- Contraintes pour la table `interventions`!
--!
ALTER TABLE `interventions`!
ADD CONSTRAINT `fk_interventions_promotions1` FOREIGN KEY (`promotion_id`) REFERENCES `promotions` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,!
ADD CONSTRAINT `fk_interventions_units1` FOREIGN KEY (`unit_id`) REFERENCES `units`
(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,!
ADD CONSTRAINT `fk_interventions_users1` FOREIGN KEY (`user_id`) REFERENCES `users`
(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;!
!
--!-- Contraintes pour la table `programs`!
--!
ALTER TABLE `programs`!
ADD CONSTRAINT `fk_programs_units1` FOREIGN KEY (`unit_id`) REFERENCES `units` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;!
!
--!-- Contraintes pour la table `promotions`!
--!
ALTER TABLE `promotions`!
ADD CONSTRAINT `fk_promotions_promotion_types1` FOREIGN KEY (`promotion_type_id`) REFERENCES `promotion_types` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;!
!
--!-- Contraintes pour la table `tests`!
--!
ALTER TABLE `tests`!
ADD CONSTRAINT `fk_tests_interventions1` FOREIGN KEY (`intervention_id`) REFERENCES
`interventions` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,!
ADD CONSTRAINT `fk_tests_test_types1` FOREIGN KEY (`test_type_id`) REFERENCES
`test_types` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;!
!
--!
-- Contraintes pour la table `units_promotions`!
--!
ALTER TABLE `units_promotions`!
ADD CONSTRAINT `fk_units_has_promotions_promotions1` FOREIGN KEY (`promotion_id`) REFERENCES `promotions` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,!
ADD CONSTRAINT `fk_units_has_promotions_units1` FOREIGN KEY (`unit_id`) REFERENCES
`units` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;!
!
--!-- Contraintes pour la table `users_units`!
--!
ALTER TABLE `users_units`!
ADD CONSTRAINT `fk_users_has_units_units1` FOREIGN KEY (`unit_id`) REFERENCES
`units` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,!
ADD CONSTRAINT `fk_users_has_units_users1` FOREIGN KEY (`user_id`) REFERENCES
`users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;!
!
/*!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 */;!