2019-08-25 23:02:49 +00:00
|
|
|
create table meta
|
|
|
|
(
|
|
|
|
version_num int not null
|
|
|
|
);
|
|
|
|
|
|
|
|
create table controllers
|
|
|
|
(
|
|
|
|
id VARCHAR(33) not null
|
|
|
|
primary key
|
|
|
|
unique,
|
|
|
|
name VARCHAR(128),
|
|
|
|
ip VARCHAR(16),
|
|
|
|
port INTEGER,
|
|
|
|
relay_count INTEGER,
|
|
|
|
active BOOLEAN not null
|
|
|
|
);
|
|
|
|
|
|
|
|
create table relays
|
|
|
|
(
|
|
|
|
id INTEGER not null
|
|
|
|
primary key
|
|
|
|
unique,
|
|
|
|
name VARCHAR(128),
|
|
|
|
number INTEGER not null,
|
|
|
|
controller_id VARCHAR(33) not null
|
|
|
|
references controllers (id),
|
|
|
|
active_schedule_id VARCHAR(33)
|
|
|
|
references schedules
|
|
|
|
);
|
|
|
|
|
|
|
|
create table schedules
|
|
|
|
(
|
|
|
|
id VARCHAR(33) not null
|
|
|
|
primary key
|
|
|
|
unique,
|
|
|
|
name VARCHAR(128),
|
|
|
|
periods BLOB
|
|
|
|
);
|
2019-09-08 21:24:31 +00:00
|
|
|
|
|
|
|
INSERT INTO schedules (id, name, periods) VALUES ('off', 'off', x'00');
|