-- +goose Up
-- Messages that are HTML widgets (sendWidget) rather than plain messages.
-- A status message or an invoice message is a widget when it has a row
-- here; its state is then changed with editMessageWidgetData.
CREATE TABLE widget_messages (
chat_id BIGINT NOT NULL,
message_id BIGINT NOT NULL,
kind TEXT NOT NULL, -- job or invoice
ref_id TEXT NOT NULL, -- the delivery or the purchase
created_at BIGINT NOT NULL,
PRIMARY KEY (chat_id, message_id)
);
CREATE INDEX widget_messages_ref ON widget_messages (kind, ref_id);
-- +goose Down
DROP TABLE widget_messages;