-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSchema.sql
34 lines (27 loc) · 895 Bytes
/
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
CREATE TABLE `Restaurant`
(
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`start` TIME NOT NULL DEFAULT '08:00:00',
`end` TIME NOT NULL DEFAULT '22:00:00',
`address` VARCHAR(128) DEFAULT NULL,
`rating` TINYINT DEFAULT 0,
`name` VARCHAR(32)
);
CREATE TABLE `RestaurantPoints`
(
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`Restaurant.id` INT UNSIGNED DEFAULT NULL,
FOREIGN KEY (`Restaurant.id`) REFERENCES `Restaurant`(`id`),
`position_x` INT UNSIGNED NOT NULL,
`position_y` INT UNSIGNED NOT NULL
);
CREATE TABLE `Table`
(
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`Restaurant.id` INT UNSIGNED DEFAULT NULL,
FOREIGN KEY (`Restaurant.id`) REFERENCES `Restaurant`(`id`),
`color` VARCHAR(32) NOT NULL DEFAULT 'blue',
`position_x` INT UNSIGNED NOT NULL,
`position_y` INT UNSIGNED NOT NULL,
`radius` DECIMAL(6, 3) NOT NULL -- max of 999.999
);