-
Notifications
You must be signed in to change notification settings - Fork 0
/
bookster.schema
261 lines (234 loc) · 5.45 KB
/
bookster.schema
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
DROP TABLE IF EXISTS facilityBookings,favourites,bookables,users,companies;
CREATE TABLE users(
id int NOT NULL AUTO_INCREMENT,
email varchar(50) UNIQUE,
firstName varchar(20) NOT NULL ,
familyName varchar(20) NOT NULL ,
password varchar (255) NOT NULL ,
birth varchar (10) NOT NULL ,
address varchar(70),
PRIMARY KEY (id)
);
CREATE TABLE companies(
id int NOT NULL AUTO_INCREMENT,
companyAlias varchar(15) UNIQUE ,
name varchar(30) NOT NULL,
city varchar(30),
info varchar (255) NOT NULL,
type varchar(15) NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE bookables(
id int NOT NULL AUTO_INCREMENT,
bookableAlias varchar(15) UNIQUE,
name varchar(30) NOT NULL,
company int NOT NULL,
info varchar(255) NOT NULL,
type varchar(15) NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (company) REFERENCES companies(id)
);
CREATE TABLE favourites(
user int NOT NULL,
bookable int NOT NULL,
PRIMARY KEY (user, bookable),
FOREIGN KEY (user) REFERENCES users(id),
FOREIGN KEY (bookable) REFERENCES bookables(id)
);
CREATE TABLE facilityBookings(
bookedBy int,
bookable int NOT NULL,
title VARCHAR(30) NOT NULL,
allDay BOOLEAN NOT NULL,
start BIGINT NOT NULL,
end BIGINT,
descr VARCHAR(255),
PRIMARY KEY (bookable, start),
FOREIGN KEY (bookable) REFERENCES bookables(id)
);
INSERT INTO companies (companyAlias, name, city, info, type)VALUES(
'byggvestaSthlm',
'Byggvesta',
'Stockholm',
'Rent apartments and book laundromat',
'company'
);
INSERT INTO companies (companyAlias, name, city, info, type)VALUES(
'byggvestaLink',
'Byggvesta',
'Linköping',
'Rent apartments and book laundromat',
'company'
);
INSERT INTO companies (companyAlias, name, city, info, type) VALUES(
'dsektionenLiu',
'Datateknologsektionen',
'Linköping',
'Rent our car etc.',
'company'
);
INSERT INTO companies (companyAlias, name, city, info, type) VALUES(
'msektionenLiu',
'Maskinteknologsektionen',
'Linköping',
'Rent our car etc.',
'company'
);
INSERT INTO bookables (bookableAlias, name, company, info, type) VALUES(
'laundromat1',
'Laundromat',
1,
'Very nice laundromat. Please remember to clean the filters after use.',
'bookable'
);
INSERT INTO bookables (bookableAlias, name, company, info, type)VALUES(
'soccerField1',
'Soccer Field',
2,
'Very nice soccer field.',
'bookable'
);
INSERT INTO bookables (bookableAlias, name, company, info, type)VALUES(
'soccerField2',
'Soccer Field',
1,
'Very nice soccer field.',
'bookable'
);
INSERT INTO bookables(bookableAlias, name, company, info, type) VALUES(
'soccerField3',
'Soccer Field',
1,
'Very nice soccer field.',
'bookable'
);
INSERT INTO bookables (bookableAlias, name, company, info, type)VALUES(
'soccerField4',
'Soccer Field',
1,
'Very nice soccer field.',
'bookable'
);
INSERT INTO bookables (bookableAlias, name, company, info, type)VALUES(
'soccerField5',
'Soccer Field',
1,
'Very nice soccer field.',
'bookable'
);
INSERT INTO users (email, firstName, familyName, password, birth, address) VALUES(
'Matilda',
'Soderholm',
'password',
'1993-05-21',
'Studievägen 5'
);
INSERT INTO facilityBookings VALUES(
1,
1,
'Laundry',
FALSE,
1494852244000,
1494853244000,
'Laundry for residents at Byggvesta Stockholm'
);
INSERT INTO facilityBookings VALUES(
NULL,
1,
'Laundry',
FALSE ,
1495983600000,
1495994400000,
'Laundry for residents at Byggvesta Stockholm'
);
INSERT INTO facilityBookings VALUES(
NULL,
1,
'Laundry',
FALSE ,
1496070000000,
1496080800000,
'Laundry for residents at Byggvesta Stockholm'
);
INSERT INTO facilityBookings VALUES(
NULL,
1,
'Laundry',
FALSE ,
1496156400000,
1496167200000,
'Laundry for residents at Byggvesta Stockholm'
);
INSERT INTO facilityBookings VALUES(
NULL,
1,
'Laundry',
FALSE ,
1496242800000,
1496253600000,
'Laundry for residents at Byggvesta Stockholm'
);
INSERT INTO facilityBookings VALUES(
NULL,
1,
'Laundry',
FALSE ,
1496145600000,
1496156400000,
'Laundry for residents at Byggvesta Stockholm'
);
INSERT INTO facilityBookings VALUES(
NULL,
2,
'Soccer Field - All day',
TRUE ,
1496275200000,
1496275200000,
'All day event for Linköpings Kommun'
);
INSERT INTO facilityBookings VALUES(
NULL,
2,
'Soccer Field',
FALSE ,
1495983600000,
1495994400000,
'Only bookable for soccer practice'
);
INSERT INTO facilityBookings VALUES(
NULL,
2,
'Soccer Field',
FALSE ,
1496070000000,
1496080800000,
'Only bookable for soccer practice'
);
INSERT INTO facilityBookings VALUES(
NULL,
2,
'Soccer Field',
FALSE ,
1496156400000,
1496167200000,
'Only bookable for soccer practice'
);
INSERT INTO facilityBookings VALUES(
NULL,
2,
'Soccer Field',
FALSE ,
1496242800000,
1496253600000,
'Only bookable for soccer practice'
);
INSERT INTO facilityBookings VALUES(
NULL,
2,
'Soccer Field',
FALSE ,
1496145600000,
1496156400000,
'Only bookable for soccer practice'
);