-- Make the quarantine channels table hold more generic channel info
ALTER TABLE IF EXISTS "quarantine_channels"
    RENAME COLUMN "qc_channel_id" TO "channel_id";

-- Channels with this flag should retain old qc behaviour
ALTER TABLE IF EXISTS "quarantine_channels"
    ADD COLUMN "is_quarantine_channel" BOOL NOT NULL DEFAULT FALSE;

-- Setting flag to false allows channels to be excluded from XP even if not QC (though QC channels via the above flag imply this flag too)
ALTER TABLE IF EXISTS "quarantine_channels"
    ADD COLUMN "is_valid_for_xp" BOOL NOT NULL DEFAULT TRUE;

-- Ensure that the role ID can be null for non-qc channels
ALTER TABLE IF EXISTS "quarantine_channels"
    ALTER COLUMN "qc_role_id" DROP NOT NULL;

-- Rename table to something more suitable
ALTER TABLE IF EXISTS "quarantine_channels"
    RENAME TO "channels";
