29 lines
613 B
MySQL
29 lines
613 B
MySQL
|
-- migration to add macros
|
||
|
|
||
|
CREATE TABLE macros
|
||
|
(
|
||
|
id INTEGER
|
||
|
PRIMARY KEY
|
||
|
AUTOINCREMENT,
|
||
|
uid BLOB
|
||
|
NOT NULL
|
||
|
UNIQUE,
|
||
|
name VARCHAR(128)
|
||
|
);
|
||
|
|
||
|
CREATE TABLE junction_macro
|
||
|
(
|
||
|
macro_id INTEGER
|
||
|
NOT NULL
|
||
|
REFERENCES macros (id)
|
||
|
ON DELETE CASCADE,
|
||
|
relay_id INTEGER
|
||
|
REFERENCES relays (id)
|
||
|
ON DELETE CASCADE,
|
||
|
schedule_id INTEGER
|
||
|
REFERENCES schedules (id)
|
||
|
ON DELETE CASCADE,
|
||
|
weekday SMALLINT
|
||
|
NOT NULL
|
||
|
);
|