--- chat-mailing-messages

alter table chat_messages add mailing_message_id bigint references mailing_messages(id);

create index chat_messages_chat_mailing_ix on chat_messages(chat_id, mailing_message_id)
where mailing_message_id is not null;
