-
Notifications
You must be signed in to change notification settings - Fork 0
/
doublem.sql
293 lines (233 loc) · 9.96 KB
/
doublem.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
-- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: Jun 07, 2019 at 04:26 PM
-- Server version: 8.0.12
-- PHP Version: 7.2.10
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
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: `doublem`
--
CREATE DATABASE IF NOT EXISTS `doublem` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `doublem`;
-- --------------------------------------------------------
--
-- Table structure for table `cart`
--
CREATE TABLE `cart` (
`login` varchar(150) NOT NULL,
`id_product` int(11) NOT NULL,
`id_size` int(11) NOT NULL,
`qty` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `cart`
--
INSERT INTO `cart` (`login`, `id_product`, `id_size`, `qty`) VALUES
('admin', 1, 2, 2),
('admin', 1, 3, 3);
-- --------------------------------------------------------
--
-- Table structure for table `collections`
--
CREATE TABLE `collections` (
`id_collection` int(11) NOT NULL,
`name_collection` varchar(70) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `collections`
--
INSERT INTO `collections` (`id_collection`, `name_collection`) VALUES
(1, 'URBAN T-SHIRTS'),
(2, 'SWEATSHIRTS'),
(3, 'SALE');
-- --------------------------------------------------------
--
-- Table structure for table `photo`
--
CREATE TABLE `photo` (
`id_photo` int(11) NOT NULL,
`path_photo` varchar(60) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `photo`
--
INSERT INTO `photo` (`id_photo`, `path_photo`) VALUES
(1, 't-shirt1.jpg'),
(2, 't-shirt2.jpg'),
(3, 't-shirt3.jpg'),
(4, 't-shirt4.jpg'),
(5, 't-shirt5.jpg');
-- --------------------------------------------------------
--
-- Table structure for table `products`
--
CREATE TABLE `products` (
`id_product` int(11) NOT NULL,
`name_product` varchar(100) NOT NULL,
`price` float NOT NULL,
`id_photo` int(11) NOT NULL,
`description` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`id_collection` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `products`
--
INSERT INTO `products` (`id_product`, `name_product`, `price`, `id_photo`, `description`, `id_collection`) VALUES
(1, 'Dark Blue T-Shirt', 25.99, 1, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce tempus dolor non venenatis auctor. Proin sodales neque enim, vitae lacinia tellus consequat vel. Donec aliquet ipsum nec massa rhoncus, in aliquet nibh suscipit. Phasellus vel cursus nibh. Maecenas lorem ipsum, consectetur in posuere vel, rutrum efficitur ipsum. Donec in libero aliquet, pulvinar ligula et, varius arcu. Nam facilisis nunc eget leo pulvinar, quis malesuada enim suscipit. Donec iaculis erat leo, vel commodo urna aliquet ac. Proin scelerisque erat nec pharetra finibus. Pellentesque dui purus, feugiat sed porttitor ut, suscipit facilisis diam. In semper accumsan ipsum ut laoreet. Etiam in accumsan nibh. Vestibulum sollicitudin dignissim ligula, at dictum elit.', 1),
(2, 'Black T-Shirt', 16.85, 2, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce tempus dolor non venenatis auctor. Proin sodales neque enim, vitae lacinia tellus consequat vel. Donec aliquet ipsum nec massa rhoncus, in aliquet nibh suscipit. Phasellus vel cursus nibh. Maecenas lorem ipsum, consectetur in posuere vel, rutrum efficitur ipsum. Donec in libero aliquet, pulvinar ligula et, varius arcu. Nam facilisis nunc eget leo pulvinar, quis malesuada enim suscipit. Donec iaculis erat leo, vel commodo urna aliquet ac. Proin scelerisque erat nec pharetra finibus. Pellentesque dui purus, feugiat sed porttitor ut, suscipit facilisis diam. In semper accumsan ipsum ut laoreet. Etiam in accumsan nibh. Vestibulum sollicitudin dignissim ligula, at dictum elit.', 1),
(3, 'Neptune T-Shirt', 20.25, 3, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce tempus dolor non venenatis auctor. Proin sodales neque enim, vitae lacinia tellus consequat vel. Donec aliquet ipsum nec massa rhoncus, in aliquet nibh suscipit. Phasellus vel cursus nibh. Maecenas lorem ipsum, consectetur in posuere vel, rutrum efficitur ipsum. Donec in libero aliquet, pulvinar ligula et, varius arcu. Nam facilisis nunc eget leo pulvinar, quis malesuada enim suscipit. Donec iaculis erat leo, vel commodo urna aliquet ac. Proin scelerisque erat nec pharetra finibus. Pellentesque dui purus, feugiat sed porttitor ut, suscipit facilisis diam. In semper accumsan ipsum ut laoreet. Etiam in accumsan nibh. Vestibulum sollicitudin dignissim ligula, at dictum elit.', 1),
(4, 'Clock T-Shirt', 40.56, 4, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce tempus dolor non venenatis auctor. Proin sodales neque enim, vitae lacinia tellus consequat vel. Donec aliquet ipsum nec massa rhoncus, in aliquet nibh suscipit. Phasellus vel cursus nibh. Maecenas lorem ipsum, consectetur in posuere vel, rutrum efficitur ipsum. Donec in libero aliquet, pulvinar ligula et, varius arcu. Nam facilisis nunc eget leo pulvinar, quis malesuada enim suscipit. Donec iaculis erat leo, vel commodo urna aliquet ac. Proin scelerisque erat nec pharetra finibus. Pellentesque dui purus, feugiat sed porttitor ut, suscipit facilisis diam. In semper accumsan ipsum ut laoreet. Etiam in accumsan nibh. Vestibulum sollicitudin dignissim ligula, at dictum elit.', 1),
(5, 'Not Pink T-Shirt', 9.99, 5, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce tempus dolor non venenatis auctor. Proin sodales neque enim, vitae lacinia tellus consequat vel. Donec aliquet ipsum nec massa rhoncus, in aliquet nibh suscipit. Phasellus vel cursus nibh. Maecenas lorem ipsum, consectetur in posuere vel, rutrum efficitur ipsum. Donec in libero aliquet, pulvinar ligula et, varius arcu. Nam facilisis nunc eget leo pulvinar, quis malesuada enim suscipit. Donec iaculis erat leo, vel commodo urna aliquet ac. Proin scelerisque erat nec pharetra finibus. Pellentesque dui purus, feugiat sed porttitor ut, suscipit facilisis diam. In semper accumsan ipsum ut laoreet. Etiam in accumsan nibh. Vestibulum sollicitudin dignissim ligula, at dictum elit.', 1);
-- --------------------------------------------------------
--
-- Table structure for table `role`
--
CREATE TABLE `role` (
`id_role` int(11) NOT NULL,
`name_role` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `role`
--
INSERT INTO `role` (`id_role`, `name_role`) VALUES
(1, 'admin'),
(2, 'user');
-- --------------------------------------------------------
--
-- Table structure for table `sizes`
--
CREATE TABLE `sizes` (
`id_size` int(11) NOT NULL,
`size` varchar(2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `sizes`
--
INSERT INTO `sizes` (`id_size`, `size`) VALUES
(1, 'XS'),
(2, 'S'),
(3, 'M'),
(4, 'L'),
(5, 'XL');
-- --------------------------------------------------------
--
-- Table structure for table `subscription`
--
CREATE TABLE `subscription` (
`email` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE `user` (
`login` varchar(150) NOT NULL,
`password` varchar(150) NOT NULL,
`id_role` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `user`
--
INSERT INTO `user` (`login`, `password`, `id_role`) VALUES
('admin', 'admin', 1);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `cart`
--
ALTER TABLE `cart`
ADD UNIQUE KEY `id_product` (`id_product`,`id_size`),
ADD KEY `id_size` (`id_size`),
ADD KEY `login` (`login`);
--
-- Indexes for table `collections`
--
ALTER TABLE `collections`
ADD PRIMARY KEY (`id_collection`);
--
-- Indexes for table `photo`
--
ALTER TABLE `photo`
ADD PRIMARY KEY (`id_photo`);
--
-- Indexes for table `products`
--
ALTER TABLE `products`
ADD PRIMARY KEY (`id_product`),
ADD KEY `id_collection` (`id_collection`),
ADD KEY `id_photo` (`id_photo`);
--
-- Indexes for table `role`
--
ALTER TABLE `role`
ADD PRIMARY KEY (`id_role`);
--
-- Indexes for table `sizes`
--
ALTER TABLE `sizes`
ADD PRIMARY KEY (`id_size`);
--
-- Indexes for table `subscription`
--
ALTER TABLE `subscription`
ADD UNIQUE KEY `email` (`email`);
--
-- Indexes for table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`login`),
ADD KEY `id_role` (`id_role`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `collections`
--
ALTER TABLE `collections`
MODIFY `id_collection` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `photo`
--
ALTER TABLE `photo`
MODIFY `id_photo` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `products`
--
ALTER TABLE `products`
MODIFY `id_product` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `cart`
--
ALTER TABLE `cart`
ADD CONSTRAINT `cart_ibfk_1` FOREIGN KEY (`id_size`) REFERENCES `sizes` (`id_size`),
ADD CONSTRAINT `cart_ibfk_2` FOREIGN KEY (`id_product`) REFERENCES `products` (`id_product`),
ADD CONSTRAINT `cart_ibfk_3` FOREIGN KEY (`login`) REFERENCES `user` (`login`);
--
-- Constraints for table `products`
--
ALTER TABLE `products`
ADD CONSTRAINT `products_ibfk_1` FOREIGN KEY (`id_collection`) REFERENCES `collections` (`id_collection`),
ADD CONSTRAINT `products_ibfk_2` FOREIGN KEY (`id_photo`) REFERENCES `photo` (`id_photo`);
--
-- Constraints for table `user`
--
ALTER TABLE `user`
ADD CONSTRAINT `user_ibfk_1` FOREIGN KEY (`id_role`) REFERENCES `role` (`id_role`);
COMMIT;
/*!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 */;