This repository has been archived by the owner on Apr 24, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.sql
49 lines (39 loc) · 1.2 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
CREATE TABLE collection (
path varchar(200) NOT NULL,
parent_path varchar(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE header (
name varchar(200) NOT NULL,
value text NOT NULL,
collection_path varchar(200) NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE item (
name varchar(200) NOT NULL,
tag text NOT NULL,
collection_path varchar(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE line (
name text NOT NULL,
value text NOT NULL,
item_name varchar(200) DEFAULT NULL,
timestamp bigint(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE property (
name varchar(200) NOT NULL,
value text NOT NULL,
collection_path varchar(200) NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE collection
ADD PRIMARY KEY (path);
ALTER TABLE header
ADD PRIMARY KEY (name,collection_path),
ADD KEY collection_path (collection_path);
ALTER TABLE item
ADD PRIMARY KEY (name),
ADD KEY collection_path (collection_path);
ALTER TABLE line
ADD PRIMARY KEY (timestamp),
ADD KEY item_name (item_name);
ALTER TABLE property
ADD PRIMARY KEY (name,collection_path),
ADD KEY collection_path (collection_path);