-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathschema.sql
70 lines (64 loc) · 1.59 KB
/
schema.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
--
-- Table structure for table `bins`
--
CREATE TABLE IF NOT EXISTS bins (
bin_id TINYINT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Table structure for table `status`
--
CREATE TABLE IF NOT EXISTS status (
status_id TINYINT PRIMARY KEY AUTO_INCREMENT,
description VARCHAR(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Table structure for table `products`
--
CREATE TABLE IF NOT EXISTS products (
product_id INT(11) PRIMARY KEY AUTO_INCREMENT,
bin_id TINYINT NOT NULL,
name VARCHAR(255) NOT NULL,
FOREIGN KEY (bin_id) REFERENCES bins(bin_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Table structure for table `unclassified_products`
--
CREATE TABLE IF NOT EXISTS unclassified_products (
product_id INT(11) PRIMARY KEY AUTO_INCREMENT,
email VARCHAR(255) DEFAULT NULL,
name VARCHAR(255) NOT NULL,
creation_date DATETIME NOT NULL DEFAULT NOW(),
status_id TINYINT NOT NULL DEFAULT 1,
FOREIGN KEY (status_id) REFERENCES status(status_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Data for table `bins`
--
INSERT INTO bins VALUES
(1,'carta'),
(2,'plastica'),
(3,'vetro'),
(4,'organico'),
(5,'metalli'),
(6,'secco residuo'),
(7,'umido');
--
-- Data for table `status`
--
INSERT INTO status VALUES
(1,'product_inserted'),
(2,'product_not_valid'),
(3,'product_accepted');
--
-- Data for table `status`
--
INSERT INTO products (bin_id, name) VALUES
(1,'quaderno'),
(1,'carta'),
(2,'plastica'),
(2,'bottiglia di plastica'),
(3,'vetro'),
(3,'bottiglia di vetro'),
(4,'banana'),
(5,'lattina');