remove: lmdb
add: sqlite add: new commands
This commit is contained in:
parent
a37bdc4870
commit
9602e6e937
33 changed files with 1403 additions and 752 deletions
47
sql/migration_0.sql
Normal file
47
sql/migration_0.sql
Normal file
|
@ -0,0 +1,47 @@
|
|||
create table controllers
|
||||
(
|
||||
id INTEGER
|
||||
PRIMARY KEY
|
||||
AUTOINCREMENT,
|
||||
uid BLOB
|
||||
NOT NULL
|
||||
UNIQUE,
|
||||
name VARCHAR(128),
|
||||
command_port INTEGER
|
||||
);
|
||||
|
||||
create table relays
|
||||
(
|
||||
number INTEGER
|
||||
PRIMARY KEY
|
||||
NOT NULL,
|
||||
name VARCHAR(128)
|
||||
);
|
||||
|
||||
create table schedules
|
||||
(
|
||||
id INTEGER
|
||||
PRIMARY KEY
|
||||
AUTOINCREMENT,
|
||||
uid BLOB
|
||||
NOT NULL
|
||||
UNIQUE,
|
||||
name VARCHAR(128),
|
||||
periods BLOB
|
||||
);
|
||||
|
||||
create table junction_relay_schedule
|
||||
(
|
||||
weekday SMALLINT
|
||||
NOT NULL,
|
||||
relay_id INTEGER
|
||||
REFERENCES relays (id)
|
||||
ON DELETE CASCADE,
|
||||
schedule_id INTEGER
|
||||
DEFAULT 1
|
||||
REFERENCES schedules (id)
|
||||
ON DELETE SET DEFAULT
|
||||
);
|
||||
|
||||
INSERT INTO schedules (uid, name, periods) VALUES (x'6f666600000000000000000000000000', 'off', x'00');
|
||||
INSERT INTO schedules (uid, name, periods) VALUES (x'6f6e0000000000000000000000000000', 'on', x'010000009F05');
|
Loading…
Add table
Add a link
Reference in a new issue