--增加字段:批示留言是否已发布
ALTER TABLE "public"."task_process_summary" ADD COLUMN "is_published" int2 DEFAULT 1;
ALTER TABLE "public"."task_process_summary" ADD COLUMN "visibility_scope" VARCHAR(64) DEFAULT 'All';
COMMENT ON COLUMN "public"."task_process_summary"."is_published" IS '批示留言是否已发布，默认1';
COMMENT ON COLUMN "public"."task_process_summary"."visibility_scope" IS '可见范围，默认全部可见';



--增加表记录批示留言的可见性
DROP TABLE IF EXISTS "public"."task_process_visibility";
CREATE TABLE "public"."task_process_visibility"(
    "id"            int8 NOT NULL,
    "task_id"       int8 NOT NULL,
    "process_id"    int8 NOT NULL,
    "person_id"     int8 NOT NULL,
    "resource_type" VARCHAR(64) COLLATE "pg_catalog"."default",
    "resource_id"   int8,
    "operator_id"   int8,
    "create_date"   TIMESTAMP(6)
);
COMMENT ON COLUMN "public"."task_process_visibility"."id" IS '批示留言可见范围表';
COMMENT ON COLUMN "public"."task_process_visibility"."task_id" IS '任务id';
COMMENT ON COLUMN "public"."task_process_visibility"."process_id" IS '批示留言id';
COMMENT ON COLUMN "public"."task_process_visibility"."person_id" IS '发布人员id';
COMMENT ON COLUMN "public"."task_process_visibility"."resource_type" IS '范围值类型';
COMMENT ON COLUMN "public"."task_process_visibility"."resource_id" IS '范围值';
COMMENT ON COLUMN "public"."task_process_visibility"."create_date" IS '创建时间';

-- ----------------------------
-- Primary Key structure for table task_process_visibility
-- ----------------------------
ALTER TABLE "public"."task_process_visibility" ADD CONSTRAINT "task_process_visibility_pkey" PRIMARY KEY ("id");