-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaidb.sql
More file actions
39 lines (32 loc) · 1.01 KB
/
aidb.sql
File metadata and controls
39 lines (32 loc) · 1.01 KB
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 SCHEMA aidb;
CREATE TABLE aidb.country (
id INTEGER PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
iso TEXT,
whole_name TEXT,
nicename TEXT,
iso3 TEXT,
numcode INTEGER,
phonecode INTEGER
);
CREATE TABLE aidb.location (
id INTEGER PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
long POINT,
lat POINT
)
COMMENT ON TABLE aidb.location IS 'Location/GPS coordinates of asset/IoT/device.. these could be without address!';
CREATE TABLE aidb.address (
id INTEGER PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
description TEXT,
country INTEGER REFERENCES aidb.country (id),
town TEXT,
street TEXT,
zipcode TEXT);
COMMENT ON TABLE aidb.address IS 'Address of asset/person/company';
CREATE TABLE aidb.room (
id INTEGER PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
addr INTEGER REFERENCES aidb.address (id),
floor TEXT,
room_number INTEGER,
room_name TEXT
);
COMMENT ON TABLE aidb.room IS 'Room in building where DC is situated';