DROP INDEX IF EXISTS idx_schedule_task_operator;

ALTER TABLE schedule_tasks
    DROP CONSTRAINT IF EXISTS chk_schedule_tasks_generate_count;

ALTER TABLE schedule_tasks
    DROP COLUMN IF EXISTS generate_count,
    DROP COLUMN IF EXISTS enable_web_search,
    DROP COLUMN IF EXISTS operator_id;

ALTER TABLE schedule_tasks
    ALTER COLUMN target_platform TYPE VARCHAR(50)
    USING CASE
        WHEN target_platform IS NULL THEN NULL
        ELSE LEFT(target_platform, 50)
    END;
