ALTER TABLE "mailbox"."mail"
    ADD COLUMN "first_dept_id" varchar(40),
ALTER COLUMN "second_dept_id" TYPE varchar(40) USING "second_dept_id"::varchar(40),
  ALTER COLUMN "three_dept_id" TYPE varchar(40) USING "three_dept_id"::varchar(40),
  ALTER COLUMN "involved_dept_id" TYPE varchar(40) USING "involved_dept_id"::varchar(40),
  ALTER COLUMN "countersign_promoter_dept_id" TYPE varchar(40) USING "countersign_promoter_dept_id"::varchar(40);

COMMENT ON COLUMN "mailbox"."mail"."first_dept_id" IS '市局单位ID';

ALTER TABLE "mailbox"."mail_appeal"
ALTER COLUMN "handling_dept" TYPE varchar(40) USING "handling_dept"::varchar(40),
  ALTER COLUMN "three_dept" TYPE varchar(40) USING "three_dept"::varchar(40),
  ALTER COLUMN "second_dept" TYPE varchar(40) USING "second_dept"::varchar(40),
  ALTER COLUMN "first_dept" TYPE varchar(40) USING "first_dept"::varchar(40);

ALTER TABLE "mailbox"."mail_approval"
ALTER COLUMN "handler_dept_id" TYPE varchar(40) USING "handler_dept_id"::varchar(40);

ALTER TABLE "mailbox"."mail_countersign"
ALTER COLUMN "dept_id" TYPE varchar(40) COLLATE "pg_catalog"."default" USING "dept_id"::varchar(40);

ALTER TABLE "mailbox"."mail_extension_approval"
ALTER COLUMN "handler_dept_id" TYPE varchar(40) USING "handler_dept_id"::varchar(40);

ALTER TABLE "mailbox"."mail_flow"
ALTER COLUMN "handler_dept_id" TYPE varchar(40) USING "handler_dept_id"::varchar(40);

ALTER TABLE "mailbox"."mail_mark"
ALTER COLUMN "second_dept_id" TYPE varchar(40) COLLATE "pg_catalog"."default" USING "second_dept_id"::varchar(40),
  ALTER COLUMN "three_dept_id" TYPE varchar(40) COLLATE "pg_catalog"."default" USING "three_dept_id"::varchar(40);

ALTER TABLE "mailbox"."police_user"
ALTER COLUMN "dept_ids" TYPE varchar(40) COLLATE "pg_catalog"."default" USING "dept_ids"::varchar(40);

ALTER TABLE "mailbox"."work"
ALTER COLUMN "sign_dept_id" TYPE varchar(40) USING "sign_dept_id"::varchar(40);

ALTER TABLE "mailbox"."police_user"
ALTER COLUMN "data_dept_id" TYPE varchar(40) USING "data_dept_id"::varchar(40);

ALTER TABLE "mailbox"."notice"
ALTER COLUMN "dept_id" TYPE varchar(40) USING "dept_id"::varchar(40);