Files
shz-backend/sql/migration_add_job_nature_test.sql

31 lines
881 B
PL/PgSQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- 测试库:岗位性质字段及业务字典类型迁移。
-- 执行目标:测试 HighGo 数据库的 shz schema。
-- 岗位性质非必填;具体字典项由后台“业务字典”维护。
BEGIN;
ALTER TABLE "shz"."job"
ADD COLUMN IF NOT EXISTS "job_nature" VARCHAR(100);
COMMENT ON COLUMN "shz"."job"."job_nature"
IS '岗位性质,对应业务字典 job_nature非必填';
INSERT INTO "shz"."bussiness_dict_type" (
"dict_id", "dict_name", "dict_type", "status", "create_by", "create_time", "remark"
)
SELECT
(SELECT COALESCE(MAX("dict_id"), 0) + 1 FROM "shz"."bussiness_dict_type"),
'岗位性质',
'job_nature',
'0',
'system',
CURRENT_TIMESTAMP,
'岗位管理使用,字典项由业务字典维护'
WHERE NOT EXISTS (
SELECT 1
FROM "shz"."bussiness_dict_type"
WHERE "dict_type" = 'job_nature'
);
COMMIT;