small fixed, device repo and some device api

This commit is contained in:
2021-09-18 16:08:57 +02:00
parent 4e734c86a5
commit 26fcc1f314
19 changed files with 708 additions and 50 deletions
+3 -2
View File
@@ -5,12 +5,13 @@ CREATE TABLE device
id INT NOT NULL AUTO_INCREMENT,
bridge_id INT NOT NULL,
internal_id VARCHAR(255) NOT NULL,
icon CHAR NOT NULL,
icon VARCHAR(255) NOT NULL,
name VARCHAR(255) NOT NULL,
capabilities VARCHAR(255) NOT NULL,
button_names VARCHAR(255) NOT NULL,
PRIMARY KEY (id)
PRIMARY KEY (id),
UNIQUE (bridge_id, internal_id)
);
-- +goose StatementEnd
+1 -1
View File
@@ -7,7 +7,7 @@ CREATE TABLE device_state
saturation DOUBLE NOT NULL,
kelvin INT NOT NULL,
power TINYINT NOT NULL,
intensity INT NOT NULL,
intensity DOUBLE NOT NULL,
PRIMARY KEY (device_id)
);
+16
View File
@@ -0,0 +1,16 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE device_tag
(
device_id INT NOT NULL,
tag_name VARCHAR(255) NOT NULL,
PRIMARY KEY (device_id, tag_name),
INDEX (tag_name)
);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE device_tag;
-- +goose StatementEnd