--- create-vk-messages

CREATE TABLE vk_messages (
  id               BIGINT      NOT NULL PRIMARY KEY,
  channel_id       BIGINT      NOT NULL  REFERENCES vk_channels (id),
  user_id          BIGINT REFERENCES vk_users (id),
  chat_message_id  BIGINT REFERENCES chat_messages (id),
  vk_message_id    BIGINT,
  vk_attachment_id INTEGER     NOT NULL  DEFAULT 0,
  vk_raw_message   VARCHAR,
  out              BOOLEAN     NOT NULL  DEFAULT FALSE,
  sent             BOOLEAN     NOT NULL  DEFAULT FALSE,
  created_at       TIMESTAMPTZ NOT NULL  DEFAULT now(),
  sent_at          TIMESTAMPTZ
);

CREATE SEQUENCE vk_messages_id_seq;
