|
|
@@ -671,18 +671,22 @@ log.info("已添加template_id列到tasks表");
|
|
|
try {
|
|
|
jdbcTemplate.execute("ALTER TABLE assessment_appointments ADD COLUMN user_id BIGINT COMMENT '用户ID'");
|
|
|
} catch (Exception e) {
|
|
|
+ log.warn("Migration skipped (already exists): {}", e.getMessage());
|
|
|
}
|
|
|
try {
|
|
|
jdbcTemplate.execute("ALTER TABLE assessment_appointments ADD COLUMN guide_id BIGINT COMMENT '成长规划师ID'");
|
|
|
} catch (Exception e) {
|
|
|
+ log.warn("Migration skipped (already exists): {}", e.getMessage());
|
|
|
}
|
|
|
try {
|
|
|
jdbcTemplate.execute("ALTER TABLE assessment_appointments ADD COLUMN package_id BIGINT COMMENT '套餐ID'");
|
|
|
} catch (Exception e) {
|
|
|
+ log.warn("Migration skipped (already exists): {}", e.getMessage());
|
|
|
}
|
|
|
try {
|
|
|
jdbcTemplate.execute("ALTER TABLE assessment_appointments ADD COLUMN remark VARCHAR(500) COMMENT '备注'");
|
|
|
} catch (Exception e) {
|
|
|
+ log.warn("Migration skipped (already exists): {}", e.getMessage());
|
|
|
}
|
|
|
|
|
|
// assessment_orders 表
|
|
|
@@ -711,6 +715,7 @@ log.info("已添加template_id列到tasks表");
|
|
|
"INDEX idx_status (status)) " +
|
|
|
"ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='评估订单表'");
|
|
|
} catch (Exception e) {
|
|
|
+ log.warn("Migration skipped (already exists): {}", e.getMessage());
|
|
|
}
|
|
|
|
|
|
// 迁移26: guide_applications表添加address和bank_card字段
|
|
|
@@ -1008,12 +1013,12 @@ log.info("已添加template_id列到tasks表");
|
|
|
try {
|
|
|
jdbcTemplate.execute("ALTER TABLE product_orders ADD COLUMN logistics_no VARCHAR(64) COMMENT '物流单号'");
|
|
|
log.info("已添加logistics_no列到product_orders表");
|
|
|
- } catch (Exception e) { }
|
|
|
+ } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
|
|
|
|
|
|
try {
|
|
|
jdbcTemplate.execute("ALTER TABLE product_orders ADD COLUMN logistics_company VARCHAR(100) COMMENT '物流公司'");
|
|
|
log.info("已添加logistics_company列到product_orders表");
|
|
|
- } catch (Exception e) { }
|
|
|
+ } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
|
|
|
|
|
|
// SysConfig 种子数据
|
|
|
try {
|
|
|
@@ -1811,35 +1816,35 @@ log.info("已添加template_id列到tasks表");
|
|
|
try {
|
|
|
jdbcTemplate.execute("ALTER TABLE guides ADD COLUMN teacher_no VARCHAR(20) COMMENT '服务商编号'");
|
|
|
log.info("已添加teacher_no列到guides表");
|
|
|
- } catch (Exception e) {}
|
|
|
+ } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
|
|
|
|
|
|
try {
|
|
|
jdbcTemplate.execute("ALTER TABLE guides ADD COLUMN title VARCHAR(50) COMMENT '职称/称号'");
|
|
|
- } catch (Exception e) {}
|
|
|
+ } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
|
|
|
|
|
|
try {
|
|
|
jdbcTemplate.execute("ALTER TABLE guides ADD COLUMN specialty VARCHAR(200) COMMENT '专长领域'");
|
|
|
- } catch (Exception e) {}
|
|
|
+ } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
|
|
|
|
|
|
try {
|
|
|
jdbcTemplate.execute("ALTER TABLE guides ADD COLUMN bio TEXT COMMENT '简介'");
|
|
|
- } catch (Exception e) {}
|
|
|
+ } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
|
|
|
|
|
|
try {
|
|
|
jdbcTemplate.execute("ALTER TABLE guides ADD COLUMN experience_years TINYINT DEFAULT 0 COMMENT '从业年限'");
|
|
|
- } catch (Exception e) {}
|
|
|
+ } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
|
|
|
|
|
|
try {
|
|
|
jdbcTemplate.execute("ALTER TABLE guides ADD COLUMN rating INT DEFAULT 500 COMMENT '评分(百分位,500=5.00)'");
|
|
|
- } catch (Exception e) {}
|
|
|
+ } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
|
|
|
|
|
|
try {
|
|
|
jdbcTemplate.execute("ALTER TABLE guides ADD COLUMN total_appointments INT DEFAULT 0 COMMENT '总服务次数'");
|
|
|
- } catch (Exception e) {}
|
|
|
+ } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
|
|
|
|
|
|
try {
|
|
|
jdbcTemplate.execute("ALTER TABLE guides ADD COLUMN street_id BIGINT COMMENT '街道ID'");
|
|
|
- } catch (Exception e) {}
|
|
|
+ } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
|
|
|
|
|
|
try {
|
|
|
jdbcTemplate.execute("ALTER TABLE guides ADD COLUMN province VARCHAR(50) COMMENT '省份'");
|
|
|
@@ -1847,11 +1852,11 @@ log.info("已添加template_id列到tasks表");
|
|
|
jdbcTemplate.execute("ALTER TABLE guides ADD COLUMN district VARCHAR(50) COMMENT '区县'");
|
|
|
jdbcTemplate.execute("ALTER TABLE guides ADD COLUMN street VARCHAR(100) COMMENT '街道'");
|
|
|
log.info("已添加地址字段到guides表");
|
|
|
- } catch (Exception e) {}
|
|
|
+ } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
|
|
|
|
|
|
try {
|
|
|
jdbcTemplate.execute("ALTER TABLE guides ADD COLUMN verified_at DATETIME COMMENT '审核通过时间'");
|
|
|
- } catch (Exception e) {}
|
|
|
+ } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
|
|
|
|
|
|
// 迁移: 将 teachers 表数据合并到 guides(type='teacher')
|
|
|
try {
|
|
|
@@ -3589,44 +3594,52 @@ try {
|
|
|
try {
|
|
|
jdbcTemplate.execute("ALTER TABLE guide_packages ADD COLUMN guide_id BIGINT COMMENT '成长规划师ID' AFTER id");
|
|
|
} catch (Exception e) {
|
|
|
+ log.warn("Migration skipped (already exists): {}", e.getMessage());
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
jdbcTemplate.execute("ALTER TABLE guide_packages ADD COLUMN package_id BIGINT COMMENT '关联模板' AFTER guide_id");
|
|
|
} catch (Exception e) {
|
|
|
+ log.warn("Migration skipped (already exists): {}", e.getMessage());
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
jdbcTemplate.execute("ALTER TABLE guide_packages ADD COLUMN commission_rate INT COMMENT '佣金比例(bps,100=1%)' AFTER package_id");
|
|
|
} catch (Exception e) {
|
|
|
+ log.warn("Migration skipped (already exists): {}", e.getMessage());
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
jdbcTemplate.execute("ALTER TABLE guide_packages MODIFY COLUMN teacher_id BIGINT NULL");
|
|
|
} catch (Exception e) {
|
|
|
+ log.warn("Migration skipped (already exists): {}", e.getMessage());
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
jdbcTemplate.execute("ALTER TABLE guide_packages MODIFY COLUMN template_id BIGINT NULL");
|
|
|
} catch (Exception e) {
|
|
|
+ log.warn("Migration skipped (already exists): {}", e.getMessage());
|
|
|
}
|
|
|
|
|
|
// 迁移:guide_packages 表添加 level 列(GuidePackage 实体需要)
|
|
|
try {
|
|
|
jdbcTemplate.execute("ALTER TABLE guide_packages ADD COLUMN level VARCHAR(20) COMMENT '套餐等级' AFTER name");
|
|
|
} catch (Exception e) {
|
|
|
+ log.warn("Migration skipped (already exists): {}", e.getMessage());
|
|
|
}
|
|
|
|
|
|
// 迁移:guide_packages 表添加 validity_days 列
|
|
|
try {
|
|
|
jdbcTemplate.execute("ALTER TABLE guide_packages ADD COLUMN validity_days INT DEFAULT 0 COMMENT '有效期天数' AFTER validity_months");
|
|
|
} catch (Exception e) {
|
|
|
+ log.warn("Migration skipped (already exists): {}", e.getMessage());
|
|
|
}
|
|
|
|
|
|
// 迁移:guide_packages 表添加 sort_order 列
|
|
|
try {
|
|
|
jdbcTemplate.execute("ALTER TABLE guide_packages ADD COLUMN sort_order INT DEFAULT 0 COMMENT '排序' AFTER status");
|
|
|
} catch (Exception e) {
|
|
|
+ log.warn("Migration skipped (already exists): {}", e.getMessage());
|
|
|
}
|
|
|
|
|
|
// 成长规划师套餐服务项表
|
|
|
@@ -4110,42 +4123,42 @@ try {
|
|
|
try {
|
|
|
jdbcTemplate.execute("ALTER TABLE growth_records ADD COLUMN source_type VARCHAR(20) DEFAULT 'manual' COMMENT '来源类型: manual/platform_purchase/self_upload/supplement'");
|
|
|
log.info("已添加source_type列到growth_records表");
|
|
|
- } catch (Exception e) {}
|
|
|
+ } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
|
|
|
|
|
|
try {
|
|
|
jdbcTemplate.execute("ALTER TABLE growth_records ADD COLUMN source_file_url VARCHAR(500) COMMENT '原始报告文件URL'");
|
|
|
log.info("已添加source_file_url列到growth_records表");
|
|
|
- } catch (Exception e) {}
|
|
|
+ } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
|
|
|
|
|
|
try {
|
|
|
jdbcTemplate.execute("ALTER TABLE growth_records ADD COLUMN order_id BIGINT COMMENT '关联订单ID'");
|
|
|
log.info("已添加order_id列到growth_records表");
|
|
|
- } catch (Exception e) {}
|
|
|
+ } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
|
|
|
|
|
|
try {
|
|
|
jdbcTemplate.execute("ALTER TABLE growth_records ADD COLUMN report_date DATETIME COMMENT '测评/报告日期'");
|
|
|
log.info("已添加report_date列到growth_records表");
|
|
|
- } catch (Exception e) {}
|
|
|
+ } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
|
|
|
|
|
|
try {
|
|
|
jdbcTemplate.execute("ALTER TABLE growth_records ADD COLUMN parent_record_id BIGINT COMMENT '关联的原始档案ID(补充档案专用)'");
|
|
|
log.info("已添加parent_record_id列到growth_records表");
|
|
|
- } catch (Exception e) {}
|
|
|
+ } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
|
|
|
|
|
|
try {
|
|
|
jdbcTemplate.execute("ALTER TABLE growth_records ADD COLUMN is_latest TINYINT(1) DEFAULT 1 COMMENT '是否同组最新记录'");
|
|
|
log.info("已添加is_latest列到growth_records表");
|
|
|
- } catch (Exception e) {}
|
|
|
+ } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
|
|
|
|
|
|
try {
|
|
|
jdbcTemplate.execute("ALTER TABLE growth_records ADD COLUMN dedup_hash VARCHAR(64) COMMENT '去重哈希值(SHA256)'");
|
|
|
log.info("已添加dedup_hash列到growth_records表");
|
|
|
- } catch (Exception e) {}
|
|
|
+ } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
|
|
|
|
|
|
try {
|
|
|
jdbcTemplate.execute("ALTER TABLE growth_records ADD COLUMN parsed_data TEXT COMMENT '上传报告的解析结果(JSON)'");
|
|
|
log.info("已添加parsed_data列到growth_records表");
|
|
|
- } catch (Exception e) {}
|
|
|
+ } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
|
|
|
|
|
|
try {
|
|
|
jdbcTemplate.execute("CREATE UNIQUE INDEX IF NOT EXISTS uk_growth_dedup_hash ON growth_records(dedup_hash)");
|
|
|
@@ -5236,10 +5249,12 @@ try {
|
|
|
try {
|
|
|
jdbcTemplate.execute("ALTER TABLE pending_refund ADD INDEX idx_order_type (order_type)");
|
|
|
} catch (Exception e) {
|
|
|
+ log.warn("Migration skipped (already exists): {}", e.getMessage());
|
|
|
}
|
|
|
try {
|
|
|
jdbcTemplate.execute("ALTER TABLE pending_refund ADD INDEX idx_order_no (order_no)");
|
|
|
} catch (Exception e) {
|
|
|
+ log.warn("Migration skipped (already exists): {}", e.getMessage());
|
|
|
}
|
|
|
|
|
|
runMigration80();
|
|
|
@@ -5546,6 +5561,7 @@ try {
|
|
|
jdbcTemplate.execute("ALTER TABLE users ADD COLUMN butler_approved_at DATETIME");
|
|
|
log.info("已添加 butler 相关列到 users 表");
|
|
|
} catch (Exception e) {
|
|
|
+ log.warn("Migration skipped (already exists): {}", e.getMessage());
|
|
|
}
|
|
|
|
|
|
// 迁移 86: 创建 butler_assignments 表(会员 - 管家分配记录)
|