|
| 1 | +-- phpMyAdmin SQL Dump |
| 2 | +-- version 3.4.11.1deb2+deb7u2 |
| 3 | +-- http://www.phpmyadmin.net |
| 4 | +-- |
| 5 | +-- Client: localhost |
| 6 | +-- Généré le: Lun 11 Janvier 2016 à 00:59 |
| 7 | +-- Version du serveur: 5.5.46 |
| 8 | +-- Version de PHP: 5.4.4-14+deb7u5 |
| 9 | + |
| 10 | +SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; |
| 11 | +SET time_zone = "+00:00"; |
| 12 | + |
| 13 | + |
| 14 | +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; |
| 15 | +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; |
| 16 | +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; |
| 17 | +/*!40101 SET NAMES utf8 */; |
| 18 | + |
| 19 | +-- |
| 20 | +-- Base de données: `SopraBD` |
| 21 | +-- |
| 22 | + |
| 23 | +-- -------------------------------------------------------- |
| 24 | + |
| 25 | +-- |
| 26 | +-- Structure de la table `Equipments` |
| 27 | +-- |
| 28 | + |
| 29 | +CREATE TABLE IF NOT EXISTS `Equipments` ( |
| 30 | + `equipmentID` int(3) unsigned NOT NULL AUTO_INCREMENT, |
| 31 | + `description` text COLLATE utf8_unicode_ci, |
| 32 | + PRIMARY KEY (`equipmentID`) |
| 33 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=5 ; |
| 34 | + |
| 35 | +-- |
| 36 | +-- Contenu de la table `Equipments` |
| 37 | +-- |
| 38 | + |
| 39 | +INSERT INTO `Equipments` (`equipmentID`, `description`) VALUES |
| 40 | +(1, 'Visio'), |
| 41 | +(2, 'Téléphone'), |
| 42 | +(3, 'Salle Digilab'), |
| 43 | +(4, 'Sécurisée'); |
| 44 | + |
| 45 | +-- -------------------------------------------------------- |
| 46 | + |
| 47 | +-- |
| 48 | +-- Structure de la table `InvitedUsers` |
| 49 | +-- |
| 50 | + |
| 51 | +CREATE TABLE IF NOT EXISTS `InvitedUsers` ( |
| 52 | + `invitedUserID` int(10) unsigned NOT NULL AUTO_INCREMENT, |
| 53 | + `reservationRef` int(10) unsigned NOT NULL, |
| 54 | + `userRef` int(10) unsigned NOT NULL, |
| 55 | + PRIMARY KEY (`invitedUserID`), |
| 56 | + KEY `userRef` (`userRef`), |
| 57 | + KEY `reservationRef` (`reservationRef`) |
| 58 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; |
| 59 | + |
| 60 | +-- -------------------------------------------------------- |
| 61 | + |
| 62 | +-- |
| 63 | +-- Structure de la table `OldInvitedUsers` |
| 64 | +-- |
| 65 | + |
| 66 | +CREATE TABLE IF NOT EXISTS `OldInvitedUsers` ( |
| 67 | + `oldInvitedUserID` int(10) unsigned NOT NULL AUTO_INCREMENT, |
| 68 | + `oldReservationRef` int(12) unsigned NOT NULL, |
| 69 | + `userRef` int(10) unsigned NOT NULL, |
| 70 | + PRIMARY KEY (`oldInvitedUserID`), |
| 71 | + KEY `oldReservationRef` (`oldReservationRef`), |
| 72 | + KEY `oldInvitedUserID` (`userRef`) |
| 73 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; |
| 74 | + |
| 75 | +-- -------------------------------------------------------- |
| 76 | + |
| 77 | +-- |
| 78 | +-- Structure de la table `OldReservations` |
| 79 | +-- |
| 80 | + |
| 81 | +CREATE TABLE IF NOT EXISTS `OldReservations` ( |
| 82 | + `oldReservationID` int(12) unsigned NOT NULL AUTO_INCREMENT, |
| 83 | + `roomRef` int(10) unsigned NOT NULL, |
| 84 | + `start` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, |
| 85 | + `end` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', |
| 86 | + `ownerRef` int(10) unsigned NOT NULL, |
| 87 | + PRIMARY KEY (`oldReservationID`), |
| 88 | + KEY `roomRef` (`roomRef`), |
| 89 | + KEY `ownerRef` (`ownerRef`) |
| 90 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=5 ; |
| 91 | + |
| 92 | +-- |
| 93 | +-- Contenu de la table `OldReservations` |
| 94 | +-- |
| 95 | + |
| 96 | +INSERT INTO `OldReservations` (`oldReservationID`, `roomRef`, `start`, `end`, `ownerRef`) VALUES |
| 97 | +(1, 2, '2016-01-14 14:30:00', '2016-01-14 15:00:00', 15), |
| 98 | +(2, 1, '2015-12-07 11:18:54', '2015-12-11 10:20:54', 1), |
| 99 | +(3, 3, '2015-12-22 09:00:00', '2015-12-22 13:00:00', 1); |
| 100 | + |
| 101 | +-- -------------------------------------------------------- |
| 102 | + |
| 103 | +-- |
| 104 | +-- Structure de la table `Reservations` |
| 105 | +-- |
| 106 | + |
| 107 | +CREATE TABLE IF NOT EXISTS `Reservations` ( |
| 108 | + `reservationID` int(10) unsigned NOT NULL AUTO_INCREMENT, |
| 109 | + `roomRef` int(5) unsigned NOT NULL, |
| 110 | + `start` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, |
| 111 | + `end` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', |
| 112 | + `ownerRef` int(10) unsigned NOT NULL, |
| 113 | + PRIMARY KEY (`reservationID`), |
| 114 | + KEY `roomRef` (`roomRef`), |
| 115 | + KEY `ownerRef` (`ownerRef`) |
| 116 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=4 ; |
| 117 | + |
| 118 | +-- |
| 119 | +-- Contenu de la table `Reservations` |
| 120 | +-- |
| 121 | + |
| 122 | +INSERT INTO `Reservations` (`reservationID`, `roomRef`, `start`, `end`, `ownerRef`) VALUES |
| 123 | +(3, 1, '2016-01-10 22:13:49', '2016-01-22 17:10:00', 6); |
| 124 | + |
| 125 | +-- -------------------------------------------------------- |
| 126 | + |
| 127 | +-- |
| 128 | +-- Structure de la table `RoomEquipments` |
| 129 | +-- |
| 130 | + |
| 131 | +CREATE TABLE IF NOT EXISTS `RoomEquipments` ( |
| 132 | + `roomEquipmentID` int(10) unsigned NOT NULL AUTO_INCREMENT, |
| 133 | + `roomRef` int(5) unsigned NOT NULL, |
| 134 | + `equipmentRef` int(3) unsigned NOT NULL, |
| 135 | + PRIMARY KEY (`roomEquipmentID`), |
| 136 | + KEY `roomRef` (`roomRef`), |
| 137 | + KEY `equipmentRef` (`equipmentRef`) |
| 138 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=7 ; |
| 139 | + |
| 140 | +-- |
| 141 | +-- Contenu de la table `RoomEquipments` |
| 142 | +-- |
| 143 | + |
| 144 | +INSERT INTO `RoomEquipments` (`roomEquipmentID`, `roomRef`, `equipmentRef`) VALUES |
| 145 | +(1, 1, 1), |
| 146 | +(2, 1, 2), |
| 147 | +(3, 2, 4), |
| 148 | +(4, 3, 3), |
| 149 | +(5, 3, 1), |
| 150 | +(6, 3, 2); |
| 151 | + |
| 152 | +-- -------------------------------------------------------- |
| 153 | + |
| 154 | +-- |
| 155 | +-- Structure de la table `Rooms` |
| 156 | +-- |
| 157 | + |
| 158 | +CREATE TABLE IF NOT EXISTS `Rooms` ( |
| 159 | + `roomID` int(5) unsigned NOT NULL AUTO_INCREMENT, |
| 160 | + `siteRef` int(4) unsigned NOT NULL, |
| 161 | + `number` text COLLATE utf8_unicode_ci NOT NULL, |
| 162 | + `capacity` smallint(4) NOT NULL, |
| 163 | + PRIMARY KEY (`roomID`), |
| 164 | + KEY `siteRef` (`siteRef`) |
| 165 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=4 ; |
| 166 | + |
| 167 | +-- |
| 168 | +-- Contenu de la table `Rooms` |
| 169 | +-- |
| 170 | + |
| 171 | +INSERT INTO `Rooms` (`roomID`, `siteRef`, `number`, `capacity`) VALUES |
| 172 | +(1, 1, 'Salle Fourier', 60), |
| 173 | +(2, 1, 'Salle 102', 30), |
| 174 | +(3, 2, 'Salle 3', 3); |
| 175 | + |
| 176 | +-- -------------------------------------------------------- |
| 177 | + |
| 178 | +-- |
| 179 | +-- Structure de la table `Sites` |
| 180 | +-- |
| 181 | + |
| 182 | +CREATE TABLE IF NOT EXISTS `Sites` ( |
| 183 | + `siteID` int(4) unsigned NOT NULL AUTO_INCREMENT, |
| 184 | + `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL, |
| 185 | + `address` text COLLATE utf8_unicode_ci NOT NULL, |
| 186 | + `description` text COLLATE utf8_unicode_ci, |
| 187 | + PRIMARY KEY (`siteID`) |
| 188 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=3 ; |
| 189 | + |
| 190 | +-- |
| 191 | +-- Contenu de la table `Sites` |
| 192 | +-- |
| 193 | + |
| 194 | +INSERT INTO `Sites` (`siteID`, `name`, `address`, `description`) VALUES |
| 195 | +(1, 'INSA Toulouse', 'Avenue de Rangueil', 'Le meilleur endroit du monde'), |
| 196 | +(2, 'GEI', 'Impasse de l''informatique', NULL); |
| 197 | + |
| 198 | +-- -------------------------------------------------------- |
| 199 | + |
| 200 | +-- |
| 201 | +-- Structure de la table `test` |
| 202 | +-- |
| 203 | + |
| 204 | +CREATE TABLE IF NOT EXISTS `test` ( |
| 205 | + `name` varchar(8) NOT NULL, |
| 206 | + `age` int(8) NOT NULL |
| 207 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
| 208 | + |
| 209 | +-- |
| 210 | +-- Contenu de la table `test` |
| 211 | +-- |
| 212 | + |
| 213 | +INSERT INTO `test` (`name`, `age`) VALUES |
| 214 | +('jr', 0), |
| 215 | +('jack', 21), |
| 216 | +('name', 25); |
| 217 | + |
| 218 | +-- -------------------------------------------------------- |
| 219 | + |
| 220 | +-- |
| 221 | +-- Structure de la table `Users` |
| 222 | +-- |
| 223 | + |
| 224 | +CREATE TABLE IF NOT EXISTS `Users` ( |
| 225 | + `userID` int(10) unsigned NOT NULL AUTO_INCREMENT, |
| 226 | + `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL, |
| 227 | + `surname` varchar(50) COLLATE utf8_unicode_ci NOT NULL, |
| 228 | + `mailAddress` varchar(50) COLLATE utf8_unicode_ci NOT NULL, |
| 229 | + `password` text COLLATE utf8_unicode_ci NOT NULL, |
| 230 | + `admin` tinyint(1) NOT NULL DEFAULT '0', |
| 231 | + PRIMARY KEY (`userID`) |
| 232 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=21 ; |
| 233 | + |
| 234 | +-- |
| 235 | +-- Contenu de la table `Users` |
| 236 | +-- |
| 237 | + |
| 238 | +INSERT INTO `Users` (`userID`, `name`, `surname`, `mailAddress`, `password`, `admin`) VALUES |
| 239 | +( 1, 'Le Botlan', 'Didier', '[email protected]', 'pizza', 1), |
| 240 | +( 3, 'testUser', 'test', '[email protected]', 'a', 1), |
| 241 | +( 5, 'Donald', 'Dodo', '[email protected]', 'coincoin', 0), |
| 242 | +( 6, 'Marre', 'Daniel', '[email protected]', 'marre', 0), |
| 243 | +( 7, 'lala', 'lili', '[email protected]', 'lala', 0), |
| 244 | +( 14, 'rgautier', 'rgautier', '[email protected]', 'rgautier', 1), |
| 245 | +( 15, 'Machin', 'Truc', '[email protected]', 'mc', 0), |
| 246 | +( 17, 'root', 'admin', '[email protected]', 'adminadmin', 1), |
| 247 | +( 20, 'Bertin', 'Alexis', '[email protected]', 'alexis', 1); |
| 248 | + |
| 249 | +-- |
| 250 | +-- Contraintes pour les tables exportées |
| 251 | +-- |
| 252 | + |
| 253 | +-- |
| 254 | +-- Contraintes pour la table `InvitedUsers` |
| 255 | +-- |
| 256 | +ALTER TABLE `InvitedUsers` |
| 257 | + ADD CONSTRAINT `InvitedUsers_ibfk_1` FOREIGN KEY (`reservationRef`) REFERENCES `Reservations` (`reservationID`), |
| 258 | + ADD CONSTRAINT `InvitedUsers_ibfk_2` FOREIGN KEY (`userRef`) REFERENCES `Users` (`userID`); |
| 259 | + |
| 260 | +-- |
| 261 | +-- Contraintes pour la table `OldInvitedUsers` |
| 262 | +-- |
| 263 | +ALTER TABLE `OldInvitedUsers` |
| 264 | + ADD CONSTRAINT `OldInvitedUsers_ibfk_1` FOREIGN KEY (`oldReservationRef`) REFERENCES `OldReservations` (`oldReservationID`), |
| 265 | + ADD CONSTRAINT `OldInvitedUsers_ibfk_2` FOREIGN KEY (`userRef`) REFERENCES `Users` (`userID`); |
| 266 | + |
| 267 | +-- |
| 268 | +-- Contraintes pour la table `OldReservations` |
| 269 | +-- |
| 270 | +ALTER TABLE `OldReservations` |
| 271 | + ADD CONSTRAINT `OldReservations_ibfk_1` FOREIGN KEY (`roomRef`) REFERENCES `Rooms` (`roomID`), |
| 272 | + ADD CONSTRAINT `OldReservations_ibfk_2` FOREIGN KEY (`ownerRef`) REFERENCES `Users` (`userID`); |
| 273 | + |
| 274 | +-- |
| 275 | +-- Contraintes pour la table `Reservations` |
| 276 | +-- |
| 277 | +ALTER TABLE `Reservations` |
| 278 | + ADD CONSTRAINT `Reservations_ibfk_1` FOREIGN KEY (`roomRef`) REFERENCES `Rooms` (`roomID`), |
| 279 | + ADD CONSTRAINT `Reservations_ibfk_2` FOREIGN KEY (`ownerRef`) REFERENCES `Users` (`userID`); |
| 280 | + |
| 281 | +-- |
| 282 | +-- Contraintes pour la table `RoomEquipments` |
| 283 | +-- |
| 284 | +ALTER TABLE `RoomEquipments` |
| 285 | + ADD CONSTRAINT `RoomEquipments_ibfk_1` FOREIGN KEY (`roomRef`) REFERENCES `Rooms` (`roomID`), |
| 286 | + ADD CONSTRAINT `RoomEquipments_ibfk_2` FOREIGN KEY (`equipmentRef`) REFERENCES `Equipments` (`equipmentID`); |
| 287 | + |
| 288 | +-- |
| 289 | +-- Contraintes pour la table `Rooms` |
| 290 | +-- |
| 291 | +ALTER TABLE `Rooms` |
| 292 | + ADD CONSTRAINT `Rooms_ibfk_1` FOREIGN KEY (`siteRef`) REFERENCES `Sites` (`siteID`); |
| 293 | + |
| 294 | +DELIMITER $$ |
| 295 | +-- |
| 296 | +-- Événements |
| 297 | +-- |
| 298 | +CREATE DEFINER=`root`@`localhost` EVENT `deleteOldReservation` ON SCHEDULE EVERY 1 DAY STARTS '2016-01-10 22:37:23' ON COMPLETION NOT PRESERVE ENABLE DO INSERT INTO `OldReservations`(`oldReservationID`, `roomRef`, `start`, `end`, `ownerRef`) |
| 299 | +SELECT null, `roomRef`, `start`, `end`, `ownerRef` |
| 300 | +FROM `Reservations` |
| 301 | +WHERE end < NOW()$$ |
| 302 | + |
| 303 | +DELIMITER ; |
| 304 | + |
| 305 | +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; |
| 306 | +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; |
| 307 | +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; |
0 commit comments