fix(aihr): bind SOP reviews to pilot identity

This commit is contained in:
2026-07-14 15:43:23 +08:00
parent 64f369eff0
commit 14d91f86a9
7 changed files with 113 additions and 27 deletions
@@ -0,0 +1,24 @@
-- AIHR SOP 问答提问员工主体迁移(MySQL 8.x)
-- 仅补齐结构,不写入业务数据;可重复执行。
SET @aihr_sop_review_table_exists := (
SELECT COUNT(*)
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = 'aihr_sop_answer_review'
);
SET @aihr_sop_requester_exists := (
SELECT COUNT(*)
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = 'aihr_sop_answer_review'
AND COLUMN_NAME = 'requester_ext_party_id'
);
SET @aihr_sop_requester_ddl := IF(
@aihr_sop_review_table_exists = 1 AND @aihr_sop_requester_exists = 0,
'ALTER TABLE aihr_sop_answer_review ADD COLUMN `requester_ext_party_id` varchar(100) DEFAULT NULL COMMENT ''提问员工外部主体ID'' AFTER `source`',
'SELECT 1'
);
PREPARE aihr_sop_requester_stmt FROM @aihr_sop_requester_ddl;
EXECUTE aihr_sop_requester_stmt;
DEALLOCATE PREPARE aihr_sop_requester_stmt;