statping/sql/sqlite_up.sql

82 lines
1.7 KiB
MySQL
Raw Normal View History

2018-06-15 04:30:10 +00:00
CREATE TABLE core (
name text,
description text,
config text,
api_key text,
api_secret text,
2018-06-19 04:48:25 +00:00
style text,
footer text,
2018-06-23 00:10:37 +00:00
domain text,
2018-06-15 04:30:10 +00:00
version text
);
CREATE TABLE users (
id SERIAL PRIMARY KEY,
username text,
password text,
email text,
api_key text,
api_secret text,
2018-06-23 00:10:37 +00:00
admin bool,
2018-06-15 04:30:10 +00:00
created_at TIMESTAMP
);
CREATE TABLE services (
id SERIAL PRIMARY KEY,
name text,
domain text,
check_type text,
method text,
port integer,
expected text,
expected_status integer,
check_interval integer,
2018-06-23 00:10:37 +00:00
post_data text,
order_id integer,
2018-06-15 04:30:10 +00:00
created_at TIMESTAMP
);
CREATE TABLE hits (
id SERIAL PRIMARY KEY,
service INTEGER NOT NULL REFERENCES services(id) ON DELETE CASCADE ON UPDATE CASCADE,
latency float,
created_at TIMESTAMP
);
CREATE TABLE failures (
id SERIAL PRIMARY KEY,
issue text,
2018-06-23 04:17:57 +00:00
method text,
2018-06-15 04:30:10 +00:00
service INTEGER NOT NULL REFERENCES services(id) ON DELETE CASCADE ON UPDATE CASCADE,
created_at TIMESTAMP
);
2018-06-22 06:56:44 +00:00
CREATE TABLE checkins (
id SERIAL PRIMARY KEY,
service INTEGER NOT NULL REFERENCES services(id) ON DELETE CASCADE ON UPDATE CASCADE,
check_interval integer,
api text,
created_at TIMESTAMP
);
2018-06-23 00:10:37 +00:00
CREATE TABLE communication (
id SERIAL PRIMARY KEY,
method text,
host text,
port integer,
2018-06-23 04:17:57 +00:00
username text,
2018-06-23 00:10:37 +00:00
password text,
var1 text,
var2 text,
api_key text,
api_secret text,
enabled boolean,
removable boolean,
limits integer,
created_at TIMESTAMP
);
2018-06-15 04:30:10 +00:00
CREATE INDEX idx_hits ON hits(service);
2018-06-22 06:56:44 +00:00
CREATE INDEX idx_failures ON failures(service);
CREATE INDEX idx_checkins ON checkins(service);