|
|
@@ -10435,19 +10435,9 @@ public class DatabaseInitializer implements CommandLineRunner {
|
|
|
// 无此列;2026-09-06 生产已手动 ALTER 补列(JwtInterceptor/SurveyServiceImpl 查询报 Unknown column
|
|
|
// 'member_type' 修复,生产旧代码兼容用),部署含 exist=false 的新代码后该列不再被引用,可留可删。
|
|
|
|
|
|
- // 迁移298: tasks表新增is_daily_progress/target_value字段 + source_type注释更新(统一任务系统)
|
|
|
- try {
|
|
|
- jdbcTemplate.execute("ALTER TABLE tasks ADD COLUMN is_daily_progress TINYINT DEFAULT 0 COMMENT '1=每日进度型任务(无deadline,每日重置)' AFTER source_id");
|
|
|
- log.info("已添加is_daily_progress列到tasks表");
|
|
|
- } catch (Exception e) {
|
|
|
- // 列已存在,忽略
|
|
|
- }
|
|
|
- try {
|
|
|
- jdbcTemplate.execute("ALTER TABLE tasks ADD COLUMN target_value INT DEFAULT NULL COMMENT '进度目标值(is_daily_progress=1时有效)' AFTER is_daily_progress");
|
|
|
- log.info("已添加target_value列到tasks表");
|
|
|
- } catch (Exception e) {
|
|
|
- // 列已存在,忽略
|
|
|
- }
|
|
|
+ // 迁移302: tasks表新增is_daily_progress/target_value字段(统一任务系统;原迁移298用 AFTER source_id,列缺失时会被静默吞掉)
|
|
|
+ ensureColumn("tasks", "is_daily_progress", "TINYINT DEFAULT 0 COMMENT '1=每日进度型任务(无deadline,每日重置)'");
|
|
|
+ ensureColumn("tasks", "target_value", "INT DEFAULT NULL COMMENT '进度目标值(is_daily_progress=1时有效)'");
|
|
|
try {
|
|
|
jdbcTemplate.execute("ALTER TABLE tasks MODIFY COLUMN source_type VARCHAR(32) DEFAULT NULL COMMENT '来源类型: self/assigned/plan/health_plan/training_plan/onboarding/ai/template/article/activity/purchase'");
|
|
|
log.info("已更新tasks.source_type注释");
|