-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.sql
40 lines (36 loc) · 1.64 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
CREATE TABLE alert (
id SERIAL PRIMARY KEY,
event_time TIMESTAMP NOT NULL,
received_at TIMESTAMP NOT NULL,
notification_sent BOOLEAN NOT NULL DEFAULT FALSE,
device_id VARCHAR NOT NULL REFERENCES device(id),
face_model_id VARCHAR NOT NULL REFERENCES face_detection_model(id),
mask_model_id VARCHAR NOT NULL REFERENCES mask_classification_model(id),
image_id INT NOT NULL REFERENCES image(id)
);
CREATE TABLE device (
id VARCHAR PRIMARY KEY,
type VARCHAR NOT NULL,
enrolled_on TIMESTAMP NOT NULL,
latitude REAL NOT NULL,
longitude REAL NOT NULL
);
CREATE TABLE image (
id SERIAL PRIMARY KEY,
format VARCHAR,
width INT,
height INT,
data bytea
);
CREATE TABLE face_detection_model (
id VARCHAR PRIMARY KEY,
created_at TIMESTAMP NOT NULL,
name VARCHAR NOT NULL,
threshold REAL NOT NULL
);
CREATE TABLE mask_classification_model (
id VARCHAR PRIMARY KEY,
created_at TIMESTAMP NOT NULL,
name VARCHAR NOT NULL,
threshold REAL NOT NULL
);