core-legacy/sql/migration_0.sql
Tobias Reisinger 51ab1d7982 fix: save id as blob, not as string
add: some progress to new discovery
add: some tests
remove: migrations. restarting for now
2020-02-23 20:06:14 +01:00

43 lines
1 KiB
SQL

create table meta
(
version_num int not null
);
create table controllers
(
id VARCHAR(33) not null
primary key
unique,
name VARCHAR(128),
ip VARCHAR(16),
port INTEGER,
relay_count INTEGER,
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 VARCHAR(33)
references schedules,
tag vARCHAR(64)
);
create table schedules
(
id VARCHAR(33) not null
primary key
unique,
name VARCHAR(128),
periods BLOB,
tag vARCHAR(64)
);
INSERT INTO schedules (id, name, periods) VALUES (x'6f666600000000000000000000000000', 'off', x'00');
INSERT INTO schedules (id, name, periods) VALUES (x'6f6e0000000000000000000000000000', 'on', x'010000009F05');