Merge branch 'rewrite' into dev
This commit is contained in:
commit
b68cdd224e
129 changed files with 40046 additions and 3787 deletions
|
@ -6,10 +6,12 @@ create table meta
|
|||
|
||||
create table controllers
|
||||
(
|
||||
id VARCHAR(64)
|
||||
NOT NULL
|
||||
PRIMARY KEY
|
||||
UNIQUE,
|
||||
id INTEGER
|
||||
PRIMARY KEY
|
||||
AUTOINCREMENT,
|
||||
uid BLOB
|
||||
NOT NULL
|
||||
UNIQUE,
|
||||
name VARCHAR(128),
|
||||
ip VARCHAR(16),
|
||||
port INTEGER,
|
||||
|
@ -26,9 +28,10 @@ create table relays
|
|||
name VARCHAR(128),
|
||||
number INTEGER
|
||||
NOT NULL,
|
||||
controller_id VARCHAR(33)
|
||||
controller_id INTEGER
|
||||
NOT NULL
|
||||
REFERENCES controllers (id)
|
||||
ON DELETE CASCADE
|
||||
);
|
||||
|
||||
create table schedules
|
||||
|
@ -36,7 +39,7 @@ create table schedules
|
|||
id INTEGER
|
||||
PRIMARY KEY
|
||||
AUTOINCREMENT,
|
||||
uid VARCHAR(33)
|
||||
uid BLOB
|
||||
NOT NULL
|
||||
UNIQUE,
|
||||
name VARCHAR(128),
|
||||
|
@ -57,11 +60,14 @@ create table junction_tag
|
|||
(
|
||||
tag_id INTEGER
|
||||
NOT NULL
|
||||
REFERENCES tags (id),
|
||||
REFERENCES tags (id)
|
||||
ON DELETE CASCADE,
|
||||
relay_id INTEGER
|
||||
REFERENCES relays (id),
|
||||
REFERENCES relays (id)
|
||||
ON DELETE CASCADE,
|
||||
schedule_id INTEGER
|
||||
REFERENCES schedules (id)
|
||||
ON DELETE CASCADE
|
||||
);
|
||||
|
||||
create table junction_relay_schedule
|
||||
|
@ -69,11 +75,12 @@ create table junction_relay_schedule
|
|||
weekday SMALLINT
|
||||
NOT NULL,
|
||||
relay_id INTEGER
|
||||
NOT NULL
|
||||
REFERENCES relays (id),
|
||||
REFERENCES relays (id)
|
||||
ON DELETE CASCADE,
|
||||
schedule_id INTEGER
|
||||
NOT NULL
|
||||
DEFAULT 1
|
||||
REFERENCES schedules (id)
|
||||
ON DELETE SET DEFAULT
|
||||
);
|
||||
|
||||
INSERT INTO schedules (uid, name, periods) VALUES (x'6f666600000000000000000000000000', 'off', x'00');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue