|
|
@@ -2934,6 +2934,28 @@ log.info("已添加template_id列到tasks表");
|
|
|
ensureColumn("family_challenge", "target_mode", "VARCHAR(20) DEFAULT 'aggregate' COMMENT '目标模式: aggregate=集体总合/all_members=全员个人目标'");
|
|
|
ensureColumn("family_challenge", "target_value", "INT DEFAULT 0 COMMENT '目标值(aggregate=家庭合计值, all_members=每人目标值)'");
|
|
|
|
|
|
+ // 迁移248: 创建 health_report_edit_logs 表(健康报告修改留痕,原迁移222误置于initializeDefaultData中仅测试环境执行)
|
|
|
+ try {
|
|
|
+ jdbcTemplate.execute("CREATE TABLE IF NOT EXISTS health_report_edit_logs (" +
|
|
|
+ "id BIGINT AUTO_INCREMENT PRIMARY KEY, " +
|
|
|
+ "report_id BIGINT NOT NULL, " +
|
|
|
+ "user_id BIGINT, " +
|
|
|
+ "report_type VARCHAR(32), " +
|
|
|
+ "action VARCHAR(20) COMMENT 'create/edit', " +
|
|
|
+ "before_payload LONGTEXT, " +
|
|
|
+ "after_payload LONGTEXT, " +
|
|
|
+ "created_at DATETIME DEFAULT CURRENT_TIMESTAMP, " +
|
|
|
+ "INDEX idx_report_id (report_id)" +
|
|
|
+ ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='健康报告修改留痕'");
|
|
|
+ log.info("已创建health_report_edit_logs表");
|
|
|
+ } catch (Exception e) {
|
|
|
+ // 表已存在,忽略错误
|
|
|
+ }
|
|
|
+
|
|
|
+ // 迁移249: file_record 表添加 file_type 和 description 列(原迁移221/228误置于seedFullRegionData中,区域数据非空时永不执行)
|
|
|
+ ensureColumn("file_record", "file_type", "VARCHAR(50) DEFAULT NULL COMMENT '文件类型: image/pdf/video/audio/other'");
|
|
|
+ ensureColumn("file_record", "description", "TEXT COMMENT '文件描述'");
|
|
|
+
|
|
|
log.info("数据库迁移完成");
|
|
|
|
|
|
// ==================== 健康维度 Phase 1: health_dimension_score / health_data_source_record / health_norm_reference ====================
|
|
|
@@ -8795,9 +8817,6 @@ private void runMigration100() {
|
|
|
// 修改失败,忽略错误(幂等)
|
|
|
}
|
|
|
|
|
|
- // 迁移221: file_record表添加file_type字段
|
|
|
- ensureColumn("file_record", "file_type", "VARCHAR(20) DEFAULT NULL COMMENT '文件类型: image/pdf/video/audio/other'");
|
|
|
-
|
|
|
// 迁移222: 创建 file_tag 表(文件标签字典)
|
|
|
try {
|
|
|
jdbcTemplate.execute(
|
|
|
@@ -8843,10 +8862,6 @@ private void runMigration100() {
|
|
|
} catch (Exception e) {
|
|
|
log.warn("创建file_tag_rel表失败: " + e.getMessage());
|
|
|
}
|
|
|
- // 迁移228: file_record 添加 file_type 和 description 列
|
|
|
- ensureColumn("file_record", "file_type", "VARCHAR(50) DEFAULT NULL COMMENT '文件类型(image/video/doc/etc)'");
|
|
|
- ensureColumn("file_record", "description", "TEXT COMMENT '文件描述'");
|
|
|
- log.info("已添加file_record.file_type和description列");
|
|
|
|
|
|
// 迁移229: 新增GROWTH_COACH权益(7X24小时成长教练)到FAMILY/PREMIUM,及mascot_ai功能开关
|
|
|
try {
|