-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbellisestyle.sql
202 lines (161 loc) · 5.28 KB
/
bellisestyle.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
-- phpMyAdmin SQL Dump
-- version 4.1.14
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Feb 15, 2018 at 08:56 PM
-- Server version: 5.6.17
-- PHP Version: 5.5.12
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 */;
--
-- Database: `bellisestyle`
--
CREATE DATABASE IF NOT EXISTS `bellisestyle` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `bellisestyle`;
-- --------------------------------------------------------
--
-- Table structure for table `categories`
--
CREATE TABLE IF NOT EXISTS `categories` (
`ID` int(3) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`createdAt` datetime NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ;
INSERT INTO `categories` (`name`, `createdAt`) VALUES ('Sans Categorie', NOW());
-- --------------------------------------------------------
--
-- Table structure for table `color`
--
CREATE TABLE IF NOT EXISTS `color` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`color` varchar(30) NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ;
-- --------------------------------------------------------
--
-- Table structure for table `in_process`
--
CREATE TABLE IF NOT EXISTS `in_process` (
`productID` varchar(5) NOT NULL,
PRIMARY KEY (`productID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `orders`
--
CREATE TABLE IF NOT EXISTS `orders` (
`ID` varchar(6) NOT NULL,
`createdAt` date NOT NULL,
`customerID` int(11) NOT NULL,
`employeeID` int(11) NOT NULL,
`livreurID` int(11) NOT NULL,
`state` enum('0','1') NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `payment`
--
CREATE TABLE IF NOT EXISTS `payment` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`productID` int(11) NOT NULL,
`customerID` int(11) NOT NULL,
`employeeID` int(11) NOT NULL,
`quantity` int(5) NOT NULL,
`paid` int(11) NOT NULL,
`createdAt` datetime NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `products`
--
CREATE TABLE IF NOT EXISTS `products` (
`ID` varchar(5) NOT NULL,
`name` varchar(100) NOT NULL,
`category` int(3) NOT NULL,
`price` int(11) NOT NULL,
`createdAt` datetime NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `product_alt`
--
CREATE TABLE IF NOT EXISTS `product_alt` (
`productID` varchar(5) NOT NULL,
`altID` varchar(5) NOT NULL,
`qty` double NOT NULL,
PRIMARY KEY (`productID`,`altID`,`qty`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `product_ordered`
--
CREATE TABLE IF NOT EXISTS `product_ordered` (
`productID` varchar(5) NOT NULL,
`orderID` varchar(6) NOT NULL,
`colorID` int(11) NOT NULL,
`quantity` int(4) NOT NULL,
`paid` int(11) NOT NULL,
PRIMARY KEY (`productID`,`orderID`,`colorID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `quantity`
--
CREATE TABLE IF NOT EXISTS `quantity` (
`productID` varchar(5) NOT NULL,
`colorID` int(11) NOT NULL,
`quantity` int(11) NOT NULL,
PRIMARY KEY (`productID`,`colorID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`fullname` varchar(100) NOT NULL,
`username` varchar(32) DEFAULT NULL,
`password` varchar(100) DEFAULT NULL,
`init` varchar(10) DEFAULT NULL,
`phone` varchar(16) DEFAULT NULL,
`facebookID` varchar(100) DEFAULT NULL,
`email` varchar(100) DEFAULT NULL,
`sex` enum('H','F') DEFAULT NULL,
`location` varchar(100) NOT NULL,
`usertype` int(1) NOT NULL,
`createdAt` date NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ;
-- --------------------------------------------------------
--
-- Table structure for table `usertype`
--
CREATE TABLE IF NOT EXISTS `usertype` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`type` varchar(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `usertype` (`type`) VALUES('Administrateur');
INSERT INTO `usertype` (`type`) VALUES('Caissiere');
INSERT INTO `usertype` (`type`) VALUES('Livreur');
INSERT INTO `usertype` (`type`) VALUES('Client');
--
-- Constraints for dumped tables
--
--
-- Constraints for table `product_ordered`
--
ALTER TABLE `product_ordered`
ADD CONSTRAINT `product_ordered_ibfk_1` FOREIGN KEY (`productID`) REFERENCES `products` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
/*!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 */;