-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcreate-db.sql
40 lines (37 loc) · 1.01 KB
/
create-db.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
CREATE TABLE data
(
id serial NOT NULL,
parent integer,
guid character varying(16),
inserted timestamp without time zone DEFAULT now(),
arrival timestamp without time zone,
production_start timestamp without time zone,
production_end timestamp without time zone,
type character varying,
value double precision,
CONSTRAINT data_id PRIMARY KEY (id)
)
WITH (
OIDS=FALSE
);
CREATE TABLE devices
(
id serial NOT NULL,
guid character varying(16),
start_timestamp timestamp without time zone NOT NULL,
end_timestamp timestamp without time zone,
name character varying,
type character varying,
group_tag character varying,
location_tag character varying,
coordsys character varying,
latitude double precision,
longitude double precision,
elevation double precision,
CONSTRAINT device_id PRIMARY KEY (id)
)
WITH (
OIDS=FALSE
);
CREATE INDEX IF NOT EXISTS data_production_start_idx ON data (production_start);
CREATE INDEX IF NOT EXISTS data_production_end_idx ON data (production_end);