define a simple message store for integrator messages

This commit is contained in:
Helmut Merz 2020-04-10 19:08:04 +02:00
parent 21f093c60c
commit 645761410c
2 changed files with 24 additions and 0 deletions

3
pgsql/msgstore/drop.sql Normal file
View file

@ -0,0 +1,3 @@
-- drop tables
drop table messages;

View file

@ -0,0 +1,21 @@
-- create tables
CREATE TABLE messages (
id bigserial NOT NULL primary key,
domain text,
action text,
class text,
item text,
sender text,
payload jsonb,
state smallint default 0,
tstamp timestamptz default current_timestamp
);
-- indexes
CREATE INDEX idx_msg ON messages USING btree (domain, action, class, item);
CREATE INDEX idx_msg_action ON messages USING btree (action);
CREATE INDEX idx_msg_state ON messages USING btree (state);
CREATE INDEX idx_msg_tstamp ON messages USING btree (tstamp);