-
Notifications
You must be signed in to change notification settings - Fork 0
/
initial.sql
36 lines (34 loc) · 1.26 KB
/
initial.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
CREATE TABLE IF NOT EXISTS hosts
(
id VARCHAR(255) NOT NULL
PRIMARY KEY,
created_at TIMESTAMP(0) NOT NULL
);
CREATE SEQUENCE IF NOT EXISTS checks_id_seq;
CREATE TABLE IF NOT EXISTS checks
(
id INTEGER DEFAULT nextval('checks_id_seq'::regclass) NOT NULL
CONSTRAINT checks_pkey
PRIMARY KEY,
created_at TIMESTAMP(0) NOT NULL,
host VARCHAR(255) NOT NULL
CONSTRAINT checks_hosts_id_fk
REFERENCES hosts,
state SMALLINT NOT NULL,
response_time FLOAT NOT NULL
);
CREATE INDEX checks_host_index
ON checks (host);
INSERT INTO hosts (id, created_at)
VALUES ('https://nonexisteddomain.com', now()),
('https://google.com', now()),
('https://youtube.com', now()),
('https://facebook.com', now()),
('https://baidu.com', now()),
('https://wikipedia.org', now()),
('https://yahoo.com', now()),
('https://tmall.com', now()),
('https://amazon.com', now()),
('https://twitter.com', now()),
('https://live.com', now()),
('https://instagram.com', now());