forked from KostyantynPanchenko/Museum
-
Notifications
You must be signed in to change notification settings - Fork 1
/
heroku
210 lines (185 loc) · 8.95 KB
/
heroku
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
DROP DATABASE IF EXISTS museum;
CREATE DATABASE museum;
USE museum;
/* table EXHIBITS */
DROP TABLE IF EXISTS exhibits;
CREATE TABLE exhibits(
id INT AUTO_INCREMENT PRIMARY KEY,
hall INT UNSIGNED NOT NULL,
name VARCHAR(45) NOT NULL,
author_id INT NOT NULL REFERENCES guides.id,
material_id INT NOT NULL REFERENCES materials.id,
technique_id INT NOT NULL REFERENCES techniques.id
)
AUTO_INCREMENT = 1000
ENGINE = innoDB
CHARSET = utf8
;
/* table AUTHORS */
DROP TABLE IF EXISTS authors;
CREATE TABLE authors(
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(45) NOT NULL
)
AUTO_INCREMENT = 1000
ENGINE = innoDB
CHARSET = utf8
;
/* table MATERIALS */
DROP TABLE IF EXISTS materials;
CREATE TABLE materials(
id INT AUTO_INCREMENT PRIMARY KEY,
description VARCHAR(45) NOT NULL
)
AUTO_INCREMENT = 1000
ENGINE = innoDB
CHARSET = utf8
;
/* table TECHNIQUES */
DROP TABLE IF EXISTS techniques;
CREATE TABLE techniques(
id INT AUTO_INCREMENT PRIMARY KEY,
description VARCHAR(45) NOT NULL
)
AUTO_INCREMENT = 1000
ENGINE = innoDB
CHARSET = utf8
;
/* table GUIDES */
DROP TABLE IF EXISTS guides;
CREATE TABLE guides(
id INT AUTO_INCREMENT PRIMARY KEY,
first_name VARCHAR(20) NOT NULL,
last_name VARCHAR(20) NOT NULL,
position VARCHAR(20) NOT NULL
)
AUTO_INCREMENT = 1000
ENGINE = innoDB
CHARSET = utf8
;
/* table EXCURSIONS */
DROP TABLE IF EXISTS excursions;
CREATE TABLE excursions(
id INT AUTO_INCREMENT PRIMARY KEY,
start TIMESTAMP NOT NULL,
end TIMESTAMP NOT NULL,
details_id INT NOT NULL REFERENCES excursion_details.id,
guide_id INT NOT NULL REFERENCES guides.id
)
AUTO_INCREMENT = 1000
ENGINE = innoDB
CHARSET = utf8
;
/* table EXCURSION_DETAILS */
DROP TABLE IF EXISTS excursion_details;
CREATE TABLE excursion_details(
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(45) NOT NULL,
duration TIME NOT NULL,
durationsec LONG NOT NULL
)
AUTO_INCREMENT = 1000
ENGINE = innoDB
CHARSET = utf8
;
/* population EXHIBITS */
INSERT INTO exhibits VALUES(0, 1, 'Wooden nippel', 1000, 1002, 1002);
INSERT INTO exhibits VALUES(0, 1, 'Iron hammer', 1002, 1001, 1004);
INSERT INTO exhibits VALUES(0, 1, 'Copper Tea Cup', 1003, 1002, 1004);
INSERT INTO exhibits VALUES(0, 1, 'Plate', 1003, 1005, 1003);
INSERT INTO exhibits VALUES(0, 1, 'Black Square', 1006, 1004, 1003);
INSERT INTO exhibits VALUES(0, 1, 'La Joconde', 1001, 1004, 1003);
INSERT INTO exhibits VALUES(0, 2, 'Atomic Lady', 1005, 1004, 1001);
INSERT INTO exhibits VALUES(0, 2, 'Elephants', 1005, 1004, 1004);
INSERT INTO exhibits VALUES(0, 2, 'The Fly', 1000, 1002, 1004);
INSERT INTO exhibits VALUES(0, 2, 'Papa Tangi', 1004, 1002, 1004);
INSERT INTO exhibits VALUES(0, 2, 'Ezhen Bosh', 1004, 1002, 1004);
INSERT INTO exhibits VALUES(0, 2, 'Garson', 1004, 1002, 1004);
INSERT INTO exhibits VALUES(0, 2, 'The Glass', 1000, 1000, 1000);
INSERT INTO exhibits VALUES(0, 3, 'Fabulous Eight', 1011, 1006, 1001);
INSERT INTO exhibits VALUES(0, 3, 'Red Sonya', 1010, 1006, 1001);
INSERT INTO exhibits VALUES(0, 3, 'Pirates of the Caribian', 1007, 1006, 1001);
INSERT INTO exhibits VALUES(0, 3, 'Retired', 1008, 1006, 1001);
INSERT INTO exhibits VALUES(0, 3, 'Rocky Balboa', 1009, 1006, 1001);
INSERT INTO exhibits VALUES(0, 3, 'The Barbarian', 1010, 1006, 1001);
INSERT INTO exhibits VALUES(0, 3, 'Pulp Fiction', 1011, 1006, 1001);
/* populating AUTHORS */
INSERT INTO authors VALUES(1000, 'Maximilian Shvarzemuller');
INSERT INTO authors VALUES(1001, 'Leonardo Da Vinci');
INSERT INTO authors VALUES(1002, 'Mazacco');
INSERT INTO authors VALUES(1003, 'Tician');
INSERT INTO authors VALUES(1004, 'Van Gogh');
INSERT INTO authors VALUES(1005, 'Salvador Dali');
INSERT INTO authors VALUES(1006, 'Milevic');
INSERT INTO authors VALUES(1007, 'Jack Sparrow');
INSERT INTO authors VALUES(1008, 'John Week');
INSERT INTO authors VALUES(1009, 'John Rembo');
INSERT INTO authors VALUES(1010, 'Conan');
INSERT INTO authors VALUES(1011, 'Quentin Tarantino');
/* populating MATERIALS */
INSERT INTO materials VALUES(1000, 'glass');
INSERT INTO materials VALUES(1001, 'iron');
INSERT INTO materials VALUES(1002, 'wood');
INSERT INTO materials VALUES(1003, 'copper');
INSERT INTO materials VALUES(1004, 'canvas');
INSERT INTO materials VALUES(1005, 'ceramic');
INSERT INTO materials VALUES(1006, 'tape');
/* populating techniques */
INSERT INTO techniques VALUES(1000, 'plain');
INSERT INTO techniques VALUES(1001, 'funky');
INSERT INTO techniques VALUES(1002, 'sobber');
INSERT INTO techniques VALUES(1003, 'handy');
INSERT INTO techniques VALUES(1004, 'blacksmith');
/* populatin EXCURSIONS */
INSERT INTO excursions VALUES(0, '2016-10-24 10:00:00', '2016-10-24 11:45:00', 1000, 1000);
INSERT INTO excursions VALUES(0, '2016-10-24 11:00:00', '2016-10-24 12:30:00', 1001, 1001);
INSERT INTO excursions VALUES(0, '2016-10-24 12:00:00', '2016-10-24 13:55:00', 1002, 1002);
INSERT INTO excursions VALUES(0, '2016-10-24 13:00:00', '2016-10-24 14:15:00', 1003, 1003);
INSERT INTO excursions VALUES(0, '2016-10-24 14:00:00', '2016-10-24 15:30:00', 1004, 1004);
INSERT INTO excursions VALUES(0, '2016-10-24 15:00:00', '2016-10-24 16:45:00', 1000, 1000);
INSERT INTO excursions VALUES(0, '2016-10-24 16:00:00', '2016-10-24 17:30:00', 1001, 1001);
INSERT INTO excursions VALUES(0, '2016-10-24 17:00:00', '2016-10-24 18:55:00', 1002, 1002);
INSERT INTO excursions VALUES(0, '2016-10-25 10:00:00', '2016-10-25 11:45:00', 1000, 1001);
INSERT INTO excursions VALUES(0, '2016-10-25 11:00:00', '2016-10-25 12:30:00', 1001, 1002);
INSERT INTO excursions VALUES(0, '2016-10-25 12:00:00', '2016-10-25 13:55:00', 1002, 1003);
INSERT INTO excursions VALUES(0, '2016-10-25 13:00:00', '2016-10-25 14:15:00', 1003, 1004);
INSERT INTO excursions VALUES(0, '2016-10-25 14:00:00', '2016-10-25 15:30:00', 1004, 1000);
INSERT INTO excursions VALUES(0, '2016-10-25 15:00:00', '2016-10-25 16:45:00', 1000, 1001);
INSERT INTO excursions VALUES(0, '2016-10-25 16:00:00', '2016-10-25 17:30:00', 1001, 1002);
INSERT INTO excursions VALUES(0, '2016-10-25 17:00:00', '2016-10-25 18:55:00', 1002, 1003);
INSERT INTO excursions VALUES(0, '2016-10-26 10:00:00', '2016-10-26 11:45:00', 1000, 1002);
INSERT INTO excursions VALUES(0, '2016-10-26 11:00:00', '2016-10-26 12:30:00', 1001, 1003);
INSERT INTO excursions VALUES(0, '2016-10-26 12:00:00', '2016-10-26 13:55:00', 1002, 1000);
INSERT INTO excursions VALUES(0, '2016-10-26 13:00:00', '2016-10-26 14:15:00', 1003, 1001);
INSERT INTO excursions VALUES(0, '2016-10-26 14:00:00', '2016-10-26 15:30:00', 1004, 1002);
INSERT INTO excursions VALUES(0, '2016-10-26 15:00:00', '2016-10-26 16:45:00', 1000, 1003);
INSERT INTO excursions VALUES(0, '2016-10-26 16:00:00', '2016-10-26 17:30:00', 1001, 1004);
INSERT INTO excursions VALUES(0, '2016-10-26 17:00:00', '2016-10-26 18:55:00', 1002, 1000);
INSERT INTO excursions VALUES(0, '2016-10-27 10:00:00', '2016-10-27 11:45:00', 1000, 1003);
INSERT INTO excursions VALUES(0, '2016-10-27 11:00:00', '2016-10-27 12:30:00', 1001, 1004);
INSERT INTO excursions VALUES(0, '2016-10-27 12:00:00', '2016-10-27 13:55:00', 1002, 1000);
INSERT INTO excursions VALUES(0, '2016-10-27 13:00:00', '2016-10-27 14:15:00', 1003, 1001);
INSERT INTO excursions VALUES(0, '2016-10-27 14:00:00', '2016-10-27 15:30:00', 1004, 1002);
INSERT INTO excursions VALUES(0, '2016-10-27 15:00:00', '2016-10-27 16:45:00', 1000, 1003);
INSERT INTO excursions VALUES(0, '2016-10-27 16:00:00', '2016-10-27 17:30:00', 1001, 1004);
INSERT INTO excursions VALUES(0, '2016-10-27 17:00:00', '2016-10-27 18:55:00', 1002, 1000);
INSERT INTO excursions VALUES(0, '2016-10-28 10:00:00', '2016-10-28 11:45:00', 1000, 1004);
INSERT INTO excursions VALUES(0, '2016-10-28 11:00:00', '2016-10-28 12:30:00', 1001, 1000);
INSERT INTO excursions VALUES(0, '2016-10-28 12:00:00', '2016-10-28 13:55:00', 1002, 1001);
INSERT INTO excursions VALUES(0, '2016-10-28 13:00:00', '2016-10-28 14:15:00', 1003, 1002);
INSERT INTO excursions VALUES(0, '2016-10-28 14:00:00', '2016-10-28 15:30:00', 1004, 1003);
INSERT INTO excursions VALUES(0, '2016-10-28 15:00:00', '2016-10-28 16:45:00', 1000, 1004);
INSERT INTO excursions VALUES(0, '2016-10-28 16:00:00', '2016-10-28 17:30:00', 1001, 1000);
INSERT INTO excursions VALUES(0, '2016-10-28 17:00:00', '2016-10-28 18:55:00', 1002, 1001);
/* populating EXCURSION_DETAILS*/
INSERT INTO excursion_details VALUES(1000, 'Movie Tour', '01:45:00', 6300);
INSERT INTO excursion_details VALUES(1001, 'Crusaider Tour', '01:30:00', 5400);
INSERT INTO excursion_details VALUES(1002, 'Paintings Tour', '01:55:00', 6900);
INSERT INTO excursion_details VALUES(1003, 'Funky Tour', '01:15:00', 4500);
INSERT INTO excursion_details VALUES(1004, 'Contemporary Tour', '01:30:00', 5400);
/* populating GUIDES */
INSERT INTO guides VALUES(1000, 'Jim', 'Beam', 'CHIEF_GUIDE');
INSERT INTO guides VALUES(1001, 'Jack', 'Daniel', 'GUIDE');
INSERT INTO guides VALUES(1002, 'Johny', 'Walker', 'GUIDE');
INSERT INTO guides VALUES(1003, 'Jose', 'Cuervo', 'GUIDE');
INSERT INTO guides VALUES(1004, 'Sauvignon', 'Blanc', 'MANAGER');