· 6 years ago · Sep 26, 2019, 06:04 PM
1-- phpMyAdmin SQL Dump
2-- version 4.8.5
3-- https://www.phpmyadmin.net/
4--
5-- Hôte : 127.0.0.1:3306
6-- Généré le : jeu. 26 sep. 2019 à 17:09
7-- Version du serveur : 5.7.26
8-- Version de PHP : 7.2.18
9
10SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
11SET AUTOCOMMIT = 0;
12START TRANSACTION;
13SET time_zone = "+00:00";
14
15
16/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
17/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
18/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
19/*!40101 SET NAMES utf8mb4 */;
20
21--
22-- Base de données : `expressfood`
23--
24
25-- --------------------------------------------------------
26
27--
28-- Structure de la table `categorie`
29--
30
31DROP TABLE IF EXISTS `categorie`;
32CREATE TABLE IF NOT EXISTS `categorie` (
33 `id` int(11) NOT NULL,
34 `categorie` varchar(45) NOT NULL,
35 PRIMARY KEY (`id`)
36) ENGINE=InnoDB DEFAULT CHARSET=latin1;
37
38--
39-- Déchargement des données de la table `categorie`
40--
41
42INSERT INTO `categorie` (`id`, `categorie`) VALUES
43(1, 'Plat'),
44(2, 'Dessert');
45
46-- --------------------------------------------------------
47
48--
49-- Structure de la table `chef`
50--
51
52DROP TABLE IF EXISTS `chef`;
53CREATE TABLE IF NOT EXISTS `chef` (
54 `id` int(11) NOT NULL,
55 `nom` varchar(45) NOT NULL,
56 `prenom` varchar(45) NOT NULL,
57 `email` varchar(45) NOT NULL,
58 `login` varchar(45) NOT NULL,
59 `mdp` varchar(45) NOT NULL,
60 PRIMARY KEY (`id`),
61 UNIQUE KEY `login_UNIQUE` (`login`),
62 UNIQUE KEY `email_UNIQUE` (`email`)
63) ENGINE=InnoDB DEFAULT CHARSET=latin1;
64
65--
66-- Déchargement des données de la table `chef`
67--
68
69INSERT INTO `chef` (`id`, `nom`, `prenom`, `email`, `login`, `mdp`) VALUES
70(1, 'Linguini', 'Alfredo', 'alfredo.linguini@expressfood.fr', 'alinguini', 'alfredo'),
71(2, 'Tatou', 'Colette', 'colette.tatou@expressfood.fr', 'ctatou', 'colette'),
72(3, 'Gusteau', 'Rémy', 'remy.gusteau@expressfood.fr', 'rgusteau', 'remy'),
73(4, 'Gusteau', 'Auguste', 'auguste.gusteau@expressfood.fr', 'agusteau', 'auguste');
74
75-- --------------------------------------------------------
76
77--
78-- Structure de la table `client`
79--
80
81DROP TABLE IF EXISTS `client`;
82CREATE TABLE IF NOT EXISTS `client` (
83 `id` int(11) NOT NULL,
84 `nom` varchar(45) NOT NULL,
85 `prenom` varchar(45) NOT NULL,
86 `adresse` varchar(90) NOT NULL,
87 `codePostal` char(5) NOT NULL,
88 `ville` varchar(45) NOT NULL,
89 `telFixe` char(10) DEFAULT NULL,
90 `telPortable` char(10) DEFAULT NULL,
91 `email` varchar(45) NOT NULL,
92 `login` varchar(45) NOT NULL,
93 `mdp` varchar(45) NOT NULL,
94 PRIMARY KEY (`id`),
95 UNIQUE KEY `email_UNIQUE` (`email`),
96 UNIQUE KEY `login_UNIQUE` (`login`)
97) ENGINE=InnoDB DEFAULT CHARSET=latin1;
98
99--
100-- Déchargement des données de la table `client`
101--
102
103INSERT INTO `client` (`id`, `nom`, `prenom`, `adresse`, `codePostal`, `ville`, `telFixe`, `telPortable`, `email`, `login`, `mdp`) VALUES
104(1, 'Durand', 'Nadia ', '5 rue Jean Jaures', '59300', 'Valenciennes', '0327152121', '0612122312', '0612122312', 'ndurand', 'nadia'),
105(2, 'Mbappe', 'Maurice ', '18 Résidence Jean Moulin', '59300', 'Valenciennes', '0327343414', '0615152315', '0615152315', 'mmbappe', 'maurice'),
106(3, 'Dupont', 'Miguel ', '19 Rue Victor Hugo', '59300', 'Valenciennes', '0327141414', '0648492563', '0648492563', 'mdupont', 'miguel'),
107(4, 'Petit', 'Gilbert', '58 Place Cuvelier', '59300', 'Valenciennes', '0328141814', '0612356984', '0612356984', 'gpetit', 'gilbert'),
108(5, 'Dziouba', 'Natacha', '62 Avenue Foch', '59300', 'Valenciennes', '0327241515', '0668956321', '0668956321', 'ndziouba', 'natacha');
109
110-- --------------------------------------------------------
111
112--
113-- Structure de la table `commande`
114--
115
116DROP TABLE IF EXISTS `commande`;
117CREATE TABLE IF NOT EXISTS `commande` (
118 `id` int(11) NOT NULL,
119 `dateCommande` date NOT NULL,
120 `totalHt` decimal(4,2) NOT NULL,
121 `statutCommande` varchar(45) NOT NULL,
122 `client_id` int(11) NOT NULL,
123 `livreur_id` int(11) NOT NULL,
124 PRIMARY KEY (`id`),
125 KEY `fk_commande_client_idx` (`client_id`),
126 KEY `fk_commande_livreur_idx` (`livreur_id`)
127) ENGINE=InnoDB DEFAULT CHARSET=latin1;
128
129--
130-- Déchargement des données de la table `commande`
131--
132
133INSERT INTO `commande` (`id`, `dateCommande`, `totalHt`, `statutCommande`, `client_id`, `livreur_id`) VALUES
134(1, '2019-09-08', '20.00', 'Livrée', 1, 1),
135(2, '2019-09-09', '60.99', 'Livrée', 3, 2),
136(3, '2019-09-11', '33.50', 'Livrée', 5, 4);
137
138-- --------------------------------------------------------
139
140--
141-- Structure de la table `lignecommande`
142--
143
144DROP TABLE IF EXISTS `lignecommande`;
145CREATE TABLE IF NOT EXISTS `lignecommande` (
146 `commande_id` int(11) NOT NULL,
147 `plat_id` int(11) NOT NULL,
148 `quantite` int(11) NOT NULL,
149 KEY `fk_ligneCommande_commande_idx` (`commande_id`),
150 KEY `fk_ligneCommande_plat_idx` (`plat_id`)
151) ENGINE=InnoDB DEFAULT CHARSET=latin1;
152
153--
154-- Déchargement des données de la table `lignecommande`
155--
156
157INSERT INTO `lignecommande` (`commande_id`, `plat_id`, `quantite`) VALUES
158(1, 5, 2),
159(1, 10, 1),
160(1, 13, 1),
161(2, 7, 3),
162(2, 12, 3),
163(3, 2, 1),
164(3, 9, 1),
165(3, 6, 1),
166(3, 4, 1),
167(3, 14, 2),
168(3, 16, 2);
169
170-- --------------------------------------------------------
171
172--
173-- Structure de la table `livreur`
174--
175
176DROP TABLE IF EXISTS `livreur`;
177CREATE TABLE IF NOT EXISTS `livreur` (
178 `id` int(11) NOT NULL,
179 `nom` varchar(45) NOT NULL,
180 `prenom` varchar(45) NOT NULL,
181 `email` varchar(45) NOT NULL,
182 `login` varchar(45) NOT NULL,
183 `mdp` varchar(45) NOT NULL,
184 `statut` varchar(45) NOT NULL,
185 `geolocalisation` varchar(45) NOT NULL,
186 PRIMARY KEY (`id`),
187 UNIQUE KEY `login_UNIQUE` (`login`),
188 UNIQUE KEY `email_UNIQUE` (`email`)
189) ENGINE=InnoDB DEFAULT CHARSET=latin1;
190
191--
192-- Déchargement des données de la table `livreur`
193--
194
195INSERT INTO `livreur` (`id`, `nom`, `prenom`, `email`, `login`, `mdp`, `statut`, `geolocalisation`) VALUES
196(1, 'Carrera', 'Sally', 'sally.carrera@expressfood.fr', 'scarrera', 'sally', 'maraude', '41.40335, 2.17303'),
197(2, 'McQueen', 'Flash', 'flash.mcqueen@expressfood.fr', 'fmcqueen', 'flash', 'réaprovisionement', '41.44338, 2.27403'),
198(3, 'Prost', 'Alain', 'alain.prost@expressfood.fr', 'aprost', 'alain', 'garage', '42.40338, 2.17403'),
199(4, 'Loeb', 'Sebastien', 'sebastien.loeb@expressfood.fr', 'sloeb', 'sebastien', 'livraison', '43.40338, 2.17503');
200
201-- --------------------------------------------------------
202
203--
204-- Structure de la table `plat`
205--
206
207DROP TABLE IF EXISTS `plat`;
208CREATE TABLE IF NOT EXISTS `plat` (
209 `id` int(11) NOT NULL,
210 `libelle` varchar(45) NOT NULL,
211 `stock` int(11) NOT NULL,
212 `prixHt` decimal(4,2) NOT NULL,
213 `chef_id` int(11) NOT NULL,
214 `categorie_id` int(11) NOT NULL,
215 PRIMARY KEY (`id`),
216 KEY `fk_plat_categorie_idx` (`categorie_id`),
217 KEY `fk_plat_chef_idx` (`chef_id`)
218) ENGINE=InnoDB DEFAULT CHARSET=latin1;
219
220--
221-- Déchargement des données de la table `plat`
222--
223
224INSERT INTO `plat` (`id`, `libelle`, `stock`, `prixHt`, `chef_id`, `categorie_id`) VALUES
225(1, 'Ratatouille', 10, '15.99', 1, 1),
226(2, 'Cassoulet', 10, '14.99', 2, 1),
227(3, 'Tartiflette', 0, '14.99', 3, 1),
228(4, 'Quiche Maroilles', 0, '12.00', 1, 1),
229(5, 'Ficèle picarde', 0, '12.00', 2, 1),
230(6, 'Paëlla', 0, '18.50', 2, 1),
231(7, 'Couscous Royal', 0, '19.99', 3, 1),
232(9, 'Boeuf Stroganov', 0, '15.50', 3, 1),
233(10, 'Tarte tatin', 0, '5.50', 2, 2),
234(11, 'Mille feuilles', 0, '5.50', 2, 2),
235(12, 'Makrout', 0, '6.50', 2, 2),
236(13, 'Opéra', 10, '5.50', 1, 2),
237(14, 'Vatrouchka', 0, '7.00', 1, 2),
238(15, 'Syrniki', 0, '5.50', 2, 2),
239(16, 'Platcek', 12, '5.50', 3, 2);
240
241--
242-- Contraintes pour les tables déchargées
243--
244
245--
246-- Contraintes pour la table `commande`
247--
248ALTER TABLE `commande`
249 ADD CONSTRAINT `fk_commande_client` FOREIGN KEY (`client_id`) REFERENCES `client` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
250 ADD CONSTRAINT `fk_commande_livreur` FOREIGN KEY (`livreur_id`) REFERENCES `livreur` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
251
252--
253-- Contraintes pour la table `lignecommande`
254--
255ALTER TABLE `lignecommande`
256 ADD CONSTRAINT `fk_ligneCommande_commande` FOREIGN KEY (`commande_id`) REFERENCES `commande` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
257 ADD CONSTRAINT `fk_ligneCommande_plat` FOREIGN KEY (`plat_id`) REFERENCES `plat` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
258
259--
260-- Contraintes pour la table `plat`
261--
262ALTER TABLE `plat`
263 ADD CONSTRAINT `fk_plat_categorie` FOREIGN KEY (`categorie_id`) REFERENCES `categorie` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
264 ADD CONSTRAINT `fk_plat_chef` FOREIGN KEY (`chef_id`) REFERENCES `chef` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
265COMMIT;
266
267/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
268/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
269/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;