-
Notifications
You must be signed in to change notification settings - Fork 0
/
sqlite_schema
53 lines (49 loc) · 1019 Bytes
/
sqlite_schema
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
CREATE TABLE sensors(
id integer primary key AUTOINCREMENT,
sn numeric unique,
note varchar
);
CREATE TABLE sqlite_sequence(name,seq);
CREATE TABLE data(
id integer primary key AUTOINCREMENT,
sn numeric,
ts numeric,
pq varchar, -- physical quantity
value varchar,
systemts DATETIME DEFAULT (strftime('%s','now'))
);
CREATE TABLE input (
id integer primary key AUTOINCREMENT,
sn varchar,
variable varchar,
value numeric,
type varchar
);
CREATE INDEX tsindex ON data (sn, pq, systemts);
CREATE INDEX stsindex ON data (systemts);
CREATE INDEX pqindex ON data (pq);
CREATE INDEX snindex ON data (sn);
CREATE TABLE session (
acc varchar,
sessid varchar primary key,
username varchar
);
create table house (
id integer primary key AUTOINCREMENT,
name varchar,
address varchar,
location varchar,
);
create table room (
id integer primary key AUTOINCREMENT,
house numeric,
name varchar
);
create table devices (
id integer primary key AUTOINCREMENT,
name varchar,
type varchar,
image varchar,
room integer,
note varchar
);