--- create-facebook-users

CREATE TABLE facebook_users (
  id              BIGINT IDENTITY (1, 1) NOT NULL PRIMARY KEY,
  channel_id      BIGINT NOT NULL REFERENCES facebook_channels (id),
  user_id         BIGINT NOT NULL,
  client_id       BIGINT REFERENCES clients (id),
  first_name      VARCHAR(255),
  last_name       VARCHAR(255),
  gender          VARCHAR(6),
  profile_picture VARCHAR(255)
);

CREATE UNIQUE INDEX facebook_users_client_id_uniq
  ON facebook_users (client_id);

CREATE UNIQUE INDEX facebook_users_channel_user_uniq
  ON facebook_users (channel_id, user_id);
