-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
-- First the table that contains the raw messages. Useful for future retrofit. | ||
create table if not exists inverter_messages | ||
( | ||
id serial | ||
constraint inverter_messages_pk | ||
primary key, | ||
raw bytea not null, | ||
type text not null, | ||
header bytea not null, | ||
time timestamp with time zone | ||
); | ||
|
||
-- Now the table that holds all the extracted data from the raw messages. | ||
create table if not exists message_data | ||
( | ||
message_id integer not null | ||
constraint message_data_inverter_messages_id_fk | ||
references inverter_messages, | ||
key text not null, | ||
value text, | ||
constraint message_data_pk | ||
primary key (message_id, key) | ||
); | ||
|
||
create index if not exists message_data_key_index | ||
on message_data (key); | ||
|
||
create index if not exists message_data_message_id_index | ||
on message_data (message_id); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters