2.0.0.sql 1.2 KB
-- 增加任务记录字段
ALTER TABLE public.task_record
    ADD remark_content jsonb NULL;

COMMENT ON COLUMN public.task_record.remark_content IS '填写反馈进度';

-- 增加任务记录字段
ALTER TABLE public.task_record
    ADD task_created_by int NOT NULL DEFAULT 0;

COMMENT ON COLUMN public.task_record.task_created_by IS '任务的创建来源';

-- 增加任务记录字段
ALTER TABLE public.task_record
    ADD assist_state int NOT NULL DEFAULT 1;

COMMENT ON COLUMN public.task_record.assist_state IS '辅导异常状态';

-- task_record 处理旧数据
WITH t_taff_assess_content AS (
    SELECT
        staff_assess_content.staff_assess_id,
        staff_assess_content.category,
        staff_assess_content."name",
        staff_assess_content.remark
    FROM
        task_record
        JOIN staff_assess_content ON task_record.staff_assess_id = staff_assess_content.staff_assess_id
            AND staff_assess_content."name" = task_record.task_name
    WHERE
        1 = 1)
UPDATE
    task_record
SET
    remark_content = t_taff_assess_content.remark
FROM
    t_taff_assess_content
WHERE
    task_record.staff_assess_id = t_taff_assess_content.staff_assess_id
    AND t_taff_assess_content."name" = task_record.task_name;