CREATE TABLE actions (
    id NUMBER(19) PRIMARY KEY,
    title VARCHAR2(1000 CHAR) NOT NULL ,
    action varchar2(255),
    payload varchar2(1024),
    chat_message_id NUMBER(19) NOT NULL REFERENCES chat_messages(id),
    client_id NUMBER(19) REFERENCES clients(id),
    deleted NUMBER(1) 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);
