statping/source/sql/mysql_up.sql

82 lines
2.0 KiB
MySQL
Raw Normal View History

2018-06-15 04:30:10 +00:00
CREATE TABLE core (
name VARCHAR(50),
description text,
config VARCHAR(50),
api_key VARCHAR(50),
api_secret VARCHAR(50),
2018-06-19 04:48:25 +00:00
style text,
footer text,
2018-06-23 00:10:37 +00:00
domain text,
version VARCHAR(50),
migration_id INT(6) NOT NULL DEFAULT 0,
use_cdn BOOL NOT NULL DEFAULT '0'
2018-06-15 04:30:10 +00:00
);
CREATE TABLE users (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50),
password text,
2018-07-05 01:50:01 +00:00
email VARCHAR (50),
2018-06-15 04:30:10 +00:00
api_key VARCHAR(50),
api_secret VARCHAR(50),
2018-06-23 05:59:29 +00:00
administrator BOOL NOT NULL DEFAULT '0',
2018-07-03 21:39:56 +00:00
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
2018-07-05 01:50:01 +00:00
INDEX (id),
UNIQUE (username, email)
2018-06-15 04:30:10 +00:00
);
CREATE TABLE services (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(50),
domain text,
check_type text,
method VARCHAR(50),
port INT(6),
expected text,
expected_status INT(6),
check_interval int(11),
2018-06-23 00:10:37 +00:00
post_data text,
order_id integer,
2018-07-03 21:39:56 +00:00
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
2018-06-15 04:30:10 +00:00
INDEX (id)
);
CREATE TABLE hits (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
service INTEGER NOT NULL,
latency float,
2018-07-03 21:39:56 +00:00
created_at DATETIME,
2018-06-15 04:30:10 +00:00
INDEX (id, service),
2018-07-03 21:39:56 +00:00
FOREIGN KEY (service) REFERENCES services(id) ON DELETE CASCADE
2018-06-15 04:30:10 +00:00
);
CREATE TABLE failures (
id INT NOT NULL AUTO_INCREMENT 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,
2018-07-03 21:39:56 +00:00
created_at DATETIME,
2018-06-15 04:30:10 +00:00
INDEX (id, service),
2018-07-03 21:39:56 +00:00
FOREIGN KEY (service) REFERENCES services(id) ON DELETE CASCADE
2018-06-22 06:56:44 +00:00
);
CREATE TABLE checkins (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
service INTEGER NOT NULL,
check_interval integer,
api text,
2018-07-03 21:39:56 +00:00
created_at DATETIME,
2018-06-22 06:56:44 +00:00
INDEX (id, service),
2018-07-03 21:39:56 +00:00
FOREIGN KEY (service) REFERENCES services(id) ON DELETE CASCADE
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,
2018-06-23 05:59:29 +00:00
enabled BOOL NOT NULL DEFAULT '0',
removable BOOL NOT NULL DEFAULT '0',
2018-06-23 00:10:37 +00:00
limits integer,
2018-07-03 21:39:56 +00:00
created_at DATETIME
2018-06-15 04:30:10 +00:00
);