-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.sql
More file actions
22 lines (20 loc) · 727 Bytes
/
Copy pathschema.sql
File metadata and controls
22 lines (20 loc) · 727 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
CREATE TABLE urls (
id SERIAL PRIMARY KEY,
url VARCHAR(255) NOT NULL,
name VARCHAR(100) NOT NULL,
check_interval INTEGER NOT NULL, -- in seconds
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE url_checks (
id SERIAL PRIMARY KEY,
url_id INTEGER REFERENCES urls(id),
status_code INTEGER,
response_time FLOAT, -- in seconds
is_up BOOLEAN,
error_message TEXT,
checked_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
);
-- Create index for faster queries
CREATE INDEX idx_url_checks_url_id ON url_checks(url_id);
CREATE INDEX idx_url_checks_checked_at ON url_checks(checked_at);