Implement proper DB migrations using Goose. Upgrade go packages.
This commit is contained in:
parent
6902facab6
commit
444e5065a4
12 changed files with 255 additions and 117 deletions
migrations
19
migrations/00002_inverters.sql
Normal file
19
migrations/00002_inverters.sql
Normal file
|
@ -0,0 +1,19 @@
|
|||
-- +goose Up
|
||||
-- +goose StatementBegin
|
||||
CREATE TABLE IF NOT EXISTS opendtu_inverters (
|
||||
timestamp TIMESTAMPTZ,
|
||||
-- FOREIGN KEY (timestamp) REFERENCES opendtu_log(timestamp),
|
||||
-- inverter_serial is TEXT as some non-Hoymiles inverters use non-numeric serial numbers.
|
||||
-- An additional advantage is that it makes plotting in Grafana easier.
|
||||
inverter_serial TEXT,
|
||||
name TEXT,
|
||||
producing BOOL,
|
||||
limit_relative NUMERIC,
|
||||
limit_absolute NUMERIC
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS opendtu_inverters_timestamp_idx ON opendtu_inverters (timestamp);
|
||||
-- +goose StatementEnd
|
||||
-- +goose Down
|
||||
-- +goose StatementBegin
|
||||
-- +goose StatementEnd
|
Loading…
Add table
Add a link
Reference in a new issue