ALTER TABLE schedule_tasks
    ADD COLUMN cover_mode VARCHAR(20) NOT NULL DEFAULT 'specific',
    ADD COLUMN cover_random_scope VARCHAR(20) NOT NULL DEFAULT 'all',
    ADD COLUMN cover_random_folder_id BIGINT;

ALTER TABLE schedule_tasks
    ADD CONSTRAINT chk_schedule_tasks_cover_mode
        CHECK (cover_mode IN ('specific', 'random'));

ALTER TABLE schedule_tasks
    ADD CONSTRAINT chk_schedule_tasks_cover_random_scope
        CHECK (cover_random_scope IN ('all', 'folder'));

ALTER TABLE schedule_tasks
    ADD CONSTRAINT chk_schedule_tasks_cover_random_folder_id
        CHECK (
            cover_random_folder_id IS NULL
            OR cover_random_folder_id > 0
        );
