|
|
@@ -10695,5 +10695,25 @@ public class DatabaseInitializer implements CommandLineRunner {
|
|
|
} catch (Exception e) {
|
|
|
log.warn("创建octopus_effect_key_person表失败: {}", e.getMessage());
|
|
|
}
|
|
|
+
|
|
|
+ // 迁移310: health_meal_record 表添加 record_date(补打日期)与 is_backfill(是否补打)字段(饮食记录重设计)
|
|
|
+ try {
|
|
|
+ jdbcTemplate.execute("ALTER TABLE health_meal_record ADD COLUMN record_date DATE NULL COMMENT '用餐日期(补打时为实际用餐日,默认等于创建日)'");
|
|
|
+ log.info("迁移310: health_meal_record.record_date 列已添加");
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.warn("迁移310: health_meal_record.record_date 已存在或添加失败: {}", e.getMessage());
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ jdbcTemplate.execute("ALTER TABLE health_meal_record ADD COLUMN is_backfill TINYINT DEFAULT 0 COMMENT '是否补打: 1=补打(无能量值), 0=当日打卡'");
|
|
|
+ log.info("迁移310: health_meal_record.is_backfill 列已添加");
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.warn("迁移310: health_meal_record.is_backfill 已存在或添加失败: {}", e.getMessage());
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ jdbcTemplate.execute("ALTER TABLE health_meal_record ADD INDEX idx_meal_record_date (member_id, record_date)");
|
|
|
+ log.info("迁移310: health_meal_record (member_id, record_date) 索引已添加");
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.warn("迁移310: health_meal_record 索引已存在或添加失败: {}", e.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
}
|