-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaidb_deploy.sql
More file actions
64 lines (53 loc) · 1.32 KB
/
Copy pathaidb_deploy.sql
File metadata and controls
64 lines (53 loc) · 1.32 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
CREATE SCHEMA aidb;
---
--- COUNTRY
---
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
);
COMMENT ON TABLE aidb.country IS 'Countries';
---
--- ADDRESS
---
CREATE TABLE aidb.address (
id INTEGER PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
extra_notes TEXT,
country INTEGER REFERENCES aidb.country (id),
town TEXT,
street TEXT,
zipcode TEXT,
longitude DOUBLE PRECISION NOT NULL,
latitude DOUBLE PRECISION NOT NULL);
COMMENT ON TABLE aidb.location IS 'Location or address of asset/person/company';
---
--- ROOM in building
---
CREATE TABLE aidb.room (
id INTEGER PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
address INTEGER REFERENCES aidb.address (id),
floor TEXT,
room_number INTEGER,
room_name TEXT,
site_name TEXT,
);
COMMENT ON TABLE aidb.room IS 'Room in building where DC is situated';
---
--- CONTACT
---
CREATE TABLE aidb.contact (
id INTEGER PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
name TEXT,
surname TEXT,
phone TEXT,
phone2 TEXT,
email TEXT,
email2 TEXT,
other TEXT ---fax and others
);
COMMENT ON TABLE aidb.contact IS 'Contact to employee or company or vendor';