core-legacy/sql/migration_0.sql

53 lines
1.2 KiB
MySQL
Raw Normal View History

2019-08-25 23:02:49 +00:00
create table meta
(
2020-04-23 15:00:12 +00:00
version_num INTEGER
NOT NULL
2019-08-25 23:02:49 +00:00
);
create table controllers
(
2020-04-23 15:00:12 +00:00
id VARCHAR(64)
NOT NULL
PRIMARY KEY
UNIQUE,
2019-08-25 23:02:49 +00:00
name VARCHAR(128),
ip VARCHAR(16),
port INTEGER,
relay_count INTEGER,
tag varchar(64),
2020-04-23 15:00:12 +00:00
active BOOLEAN
NOT NULL
2019-08-25 23:02:49 +00:00
);
create table relays
(
2020-04-23 15:00:12 +00:00
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)
2019-08-25 23:02:49 +00:00
);
create table schedules
(
2020-04-19 00:44:35 +00:00
id INTEGER
2020-04-23 15:00:12 +00:00
PRIMARY KEY
AUTOINCREMENT,
2020-04-19 00:44:35 +00:00
uid VARCHAR(33)
2020-04-23 15:00:12 +00:00
NOT NULL
UNIQUE,
2019-08-25 23:02:49 +00:00
name VARCHAR(128),
periods BLOB,
tag vARCHAR(64)
2019-08-25 23:02:49 +00:00
);
2020-04-19 00:44:35 +00:00
INSERT INTO schedules (uid, name, periods) VALUES (x'6f666600000000000000000000000000', 'off', x'00');
2020-04-23 15:00:12 +00:00
INSERT INTO schedules (uid, name, periods) VALUES (x'6f6e0000000000000000000000000000', 'on', x'010000009F05');