elderly-health-platform/sql/mysql/elderly_t4b_assessment_member_nullable.sql
2026-10-16 20:17:14 +08:00

19 lines
986 B
SQL
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.

-- ============================================================================
-- T4B 补丁:家属代理评估需写入 member_user_id = NULL 的评估记录
--
-- 背景:T4B §29/§31 要求家属代理的正式评估以「老人」为主体、作答人为家属;
-- 该记录没有提交会员(代理),因此 member_user_id 必须允许 NULL。
-- 既有自评记录(member_user_id 非空)语义不变。
-- 仅增量;幂等(MODIFY 可重复执行)。
-- ============================================================================
SET NAMES utf8mb4;
ALTER TABLE `elderly_assessment_record`
MODIFY COLUMN `member_user_id` bigint NULL DEFAULT NULL
COMMENT '提交会员(member_user.id);NULL = 家属/管理员代理提交';
SELECT 'record.member_user_id_nullable' AS item, IS_NULLABLE AS val
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='elderly_assessment_record' AND COLUMN_NAME='member_user_id';