-
Notifications
You must be signed in to change notification settings - Fork 2
/
install.sql
40 lines (36 loc) · 1.01 KB
/
install.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
37
38
39
40
-- front-end tables
CREATE TABLE checks (
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(64) NOT NULL,
type VARCHAR(16) NOT NULL,
data VARCHAR(1024) NOT NULL,
check_interval INT NOT NULL DEFAULT 60,
delay INT NOT NULL DEFAULT 1,
status ENUM ('online', 'offline') DEFAULT 'online',
enabled TINYINT(1) NOT NULL DEFAULT 1
);
CREATE TABLE contacts (
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
type VARCHAR(32) NOT NULL,
data VARCHAR(512) NOT NULL
);
CREATE TABLE alerts (
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
check_id INT NOT NULL,
contact_id INT NOT NULL,
type ENUM ('online', 'offline', 'both') DEFAULT 'both',
enabled TINYINT(1) NOT NULL DEFAULT 1
);
-- data tables
CREATE TABLE check_events (
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
check_id INT NOT NULL,
type ENUM ('online', 'offline'),
time TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE charges (
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
check_id INT NOT NULL,
type VARCHAR(32) NOT NULL,
data VARCHAR(512) NOT NULL
);