elder-yudao-pro/mysql_script/health/V005__health_collection_draft.sql

22 lines
1.5 KiB
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.

-- 老人信息采集私有草稿:与正式档案分离,允许部分填写与断点恢复。
-- 按租户 + 当前管理员 + 目标身份隔离;新建档案 draft_key=0。
-- JSON 包含敏感资料,服务端使用 EncryptTypeHandler 加密,不保存初始密码或 token。
-- CREATE IF NOT EXISTS 可重复执行,不改写已有档案。
SET NAMES utf8mb4;
CREATE TABLE IF NOT EXISTS health_collection_draft (
id bigint NOT NULL AUTO_INCREMENT COMMENT '草稿编号',
admin_id bigint NOT NULL COMMENT '当前管理员 system_users.id,由登录态取得',
draft_key bigint NOT NULL COMMENT '目标 health_identity.id;新建为 0',
current_step tinyint NOT NULL DEFAULT 1 COMMENT '当前填写步骤,当前支持 1-2',
data_json mediumtext NOT NULL COMMENT '白名单字段快照;AES 加密,明文最大 16KB',
creator varchar(64) NOT NULL DEFAULT '' COMMENT '创建者',
create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
updater varchar(64) NOT NULL DEFAULT '' COMMENT '更新者',
update_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
deleted bit(1) NOT NULL DEFAULT b'0' COMMENT '删除标记;清除草稿执行物理删除',
tenant_id bigint NOT NULL COMMENT '租户编号',
PRIMARY KEY (id),
UNIQUE KEY uk_health_collection_draft_owner (tenant_id, admin_id, draft_key)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='老人信息采集私有草稿';