--- channel-configs


-- facebook
CREATE TABLE facebook_configs (
  channel_id   BIGINT PRIMARY KEY,
  page_token   VARCHAR(255),
  verify_token VARCHAR(255)
);

INSERT INTO facebook_configs (channel_id, page_token, verify_token)
  SELECT
    id,
    page_token,
    verify_token
  FROM facebook_channels;

ALTER TABLE facebook_channels
  DROP COLUMN page_token;
ALTER TABLE facebook_channels
  DROP COLUMN verify_token;

-- telegram
CREATE TABLE telegram_configs (
  channel_id BIGINT PRIMARY KEY,
  bot_token  VARCHAR(255)
);

INSERT INTO telegram_configs (channel_id, bot_token)
  SELECT
    id,
    bot_token
  FROM telegram_channels;

ALTER TABLE telegram_channels
  DROP COLUMN bot_token;

-- vk
CREATE TABLE vk_configs (
  channel_id        BIGINT PRIMARY KEY,
  access_token      VARCHAR(255),
  confirmation_code VARCHAR(255)
);

INSERT INTO vk_configs (channel_id, access_token, confirmation_code)
  SELECT
    id,
    access_token,
    confirmation_code
  FROM vk_channels;

ALTER TABLE vk_channels
  DROP COLUMN access_token;
ALTER TABLE vk_channels
  DROP COLUMN confirmation_code;
