-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathschema.sql
More file actions
33 lines (32 loc) · 814 Bytes
/
schema.sql
File metadata and controls
33 lines (32 loc) · 814 Bytes
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
CREATE TABLE IF NOT EXISTS admins
(
id INTEGER PRIMARY KEY AUTOINCREMENT,
username TEXT NOT NULL,
password TEXT NOT NULL
);
CREATE TABLE IF NOT EXISTS users
(
name TEXT NOT NULL,
email TEXT NOT NULL,
phone TEXT DEFAULT NULL,
key TEXT NOT NULL
);
CREATE TABLE IF NOT EXISTS permissions
(
device_id TEXT NOT NULL,
user_key TEXT NOT NULL
);
CREATE TABLE IF NOT EXISTS event_logs
(
device_id TEXT NOT NULL,
user_key TEXT,
operation_type TEXT NOT NULL,
operation_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS "devices"
(
"id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"type" TEXT DEFAULT "tool",
"slack_channel_id" TEXT DEFAULT NULL
);