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,
|
2020-03-11 23:36:06 +00:00
|
|
|
tag varchar(64),
|
2019-08-25 23:02:49 +00:00
|
|
|
active BOOLEAN not null
|
|
|
|
);
|
|
|
|
|
|
|
|
create table relays
|
|
|
|
(
|
2020-04-19 00:44:35 +00:00
|
|
|
id INTEGER
|
|
|
|
not null
|
2019-08-25 23:02:49 +00:00
|
|
|
primary key
|
|
|
|
unique,
|
|
|
|
name VARCHAR(128),
|
2020-04-19 00:44:35 +00:00
|
|
|
number INTEGER
|
|
|
|
not null,
|
|
|
|
controller_id VARCHAR(33)
|
|
|
|
not null
|
2019-08-25 23:02:49 +00:00
|
|
|
references controllers (id),
|
2020-04-19 00:44:35 +00:00
|
|
|
active_schedule_id int
|
|
|
|
references schedules (id),
|
2020-02-23 19:06:14 +00:00
|
|
|
tag vARCHAR(64)
|
2019-08-25 23:02:49 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
create table schedules
|
|
|
|
(
|
2020-04-19 00:44:35 +00:00
|
|
|
id INTEGER
|
|
|
|
not null
|
2019-08-25 23:02:49 +00:00
|
|
|
primary key
|
|
|
|
unique,
|
2020-04-19 00:44:35 +00:00
|
|
|
uid VARCHAR(33)
|
|
|
|
not null
|
|
|
|
unique,
|
2019-08-25 23:02:49 +00:00
|
|
|
name VARCHAR(128),
|
2020-02-23 19:06:14 +00:00
|
|
|
periods BLOB,
|
|
|
|
tag vARCHAR(64)
|
2019-08-25 23:02:49 +00:00
|
|
|
);
|
2019-09-08 21:24:31 +00:00
|
|
|
|
2020-04-19 00:44:35 +00:00
|
|
|
INSERT INTO schedules (uid, name, periods) VALUES (x'6f666600000000000000000000000000', 'off', x'00');
|
|
|
|
INSERT INTO schedules (uid, name, periods) VALUES (x'6f6e0000000000000000000000000000', 'on', x'010000009F05');
|