-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.sql
89 lines (78 loc) · 1.3 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
create database piAlarm;
use piAlarm;
grant ALL on piAlarm.*
to piAlarm identified by 'myAlarm';
create table temps (
id int auto_increment primary key,
sensorId int,
c float,
f float,
raw int,
time TIMESTAMP
);
create table sensors (
id int auto_increment primary key,
clientId text,
pinNumber int,
type text,
serialNum text,
name text,
description text,
status boolean
);
create table clients(
id int auto_increment primary key,
identifier text,
model text,
name text,
description text,
lastCheckin timestamp
);
create table zones (
id int auto_increment primary key,
status boolean,
triggered boolean,
name text,
description text
);
create table zoneAssignment (
zoneId int,
sensorId int,
primary key (zoneId, sensorId)
);
create table users (
id int auto_increment primary key,
name text,
description text
);
create table codes(
id int auto_increment primary key,
code int,
userId int,
description text,
unique (code)
);
create table codeZones (
codeId int,
zoneId int,
primary key (codeId,zoneId)
);
create table settings (
id int auto_increment primary key,
name text,
value text
);
create table eventLog (
id int auto_increment primary key,
clientId int,
sensorId int,
zoneId int,
userId int,
eventType int,
time timestamp
);
create table events (
id int auto_increment primary key,
name text,
description text
);