add: weekly schedule support

This commit is contained in:
Tobias Reisinger 2020-04-23 17:00:12 +02:00
parent b3f75f4004
commit 44a83cd2c5
11 changed files with 220 additions and 79 deletions

View file

@ -1,51 +1,52 @@
create table meta
(
version_num int not null
version_num INTEGER
NOT NULL
);
create table controllers
(
id VARCHAR(33) not null
primary key
unique,
id VARCHAR(64)
NOT NULL
PRIMARY KEY
UNIQUE,
name VARCHAR(128),
ip VARCHAR(16),
port INTEGER,
relay_count INTEGER,
tag varchar(64),
active BOOLEAN not null
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 int
references schedules (id),
tag vARCHAR(64)
id INTEGER
PRIMARY KEY
AUTOINCREMENT,
name VARCHAR(128),
number INTEGER
NOT NULL,
controller_id VARCHAR(33)
NOT NULL
REFERENCES CONTROLLERS (ID),
schedules_ids INTEGER
REFERENCES SCHEDULES (ID),
tag vARCHAR(64)
);
create table schedules
(
id INTEGER
not null
primary key
unique,
PRIMARY KEY
AUTOINCREMENT,
uid VARCHAR(33)
not null
unique,
NOT NULL
UNIQUE,
name VARCHAR(128),
periods BLOB,
tag vARCHAR(64)
);
INSERT INTO schedules (uid, name, periods) VALUES (x'6f666600000000000000000000000000', 'off', x'00');
INSERT INTO schedules (uid, name, periods) VALUES (x'6f6e0000000000000000000000000000', 'on', x'010000009F05');
INSERT INTO schedules (uid, name, periods) VALUES (x'6f6e0000000000000000000000000000', 'on', x'010000009F05');