-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathschema.sql
31 lines (26 loc) · 1.05 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
DROP TABLE IF EXISTS `devices`;
CREATE TABLE `devices` (
`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,
`device_token` varchar(255) NOT NULL UNIQUE,
`position` point NULL,
`created_at` timestamp NOT NULL default CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
DROP TABLE IF EXISTS `cameras`;
CREATE TABLE `cameras` (
`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,
`address` varchar(255) NOT NULL,
`position` point NOT NULL,
`name` varchar(255) NOT NULL,
`created_at` timestamp NOT NULL default CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
DROP TABLE IF EXISTS `reports`;
CREATE TABLE `reports` (
`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,
`reported_at` datetime NOT NULL,
`position` point NOT NULL,
`address` varchar(255) NOT NULL,
`created_at` timestamp NOT NULL default CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);