--- fix-channel-members-uniq-indexes

DROP INDEX channel_members_user_id_uniq;
CREATE UNIQUE INDEX channel_members_user_id_uniq
  ON channel_members (channel_id, user_id)
  WHERE user_id IS NOT NULL;

DROP INDEX channel_members_group_id_uniq;
CREATE UNIQUE INDEX channel_members_group_id_uniq
  ON channel_members (channel_id, group_id)
  WHERE group_id IS NOT NULL;
