--- create-facebook-messages

CREATE TABLE facebook_messages (
  id                     BIGINT IDENTITY (1, 1) NOT NULL PRIMARY KEY,
  channel_id             BIGINT                 NOT NULL  REFERENCES facebook_channels (id),
  user_id                BIGINT REFERENCES facebook_users (id),
  chat_message_id        BIGINT REFERENCES chat_messages (id),
  facebook_message_id    VARCHAR(64),
  facebook_attachment_id INTEGER                NOT NULL  DEFAULT 0,
  facebook_raw_message   VARCHAR(8000),
  out                    BIT,
  sent                   BIT                              DEFAULT 0,
  created_at             DATETIMEOFFSET         NOT NULL  DEFAULT SYSDATETIMEOFFSET(),
  sent_at                DATETIMEOFFSET
);
