CREATE TABLE actions (
    id BIGINT PRIMARY KEY,
    title text NOT NULL ,
    action varchar(255),
    payload varchar(1024),
    chat_message_id BIGINT NOT NULL REFERENCES chat_messages(id),
    client_id BIGINT REFERENCES clients(id),
    deleted BOOLEAN NOT NULL,

    created_at TIMESTAMP WITH TIME ZONE NOT NULL,
    updated_at TIMESTAMP WITH TIME ZONE NOT NULL
);

CREATE SEQUENCE actions_id_seq;

create index actions_actions_id_chat_message_id_ix
    on actions(id, chat_message_id);
