|
|
@@ -2152,9 +2152,6 @@ log.info("已添加template_id列到tasks表");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 关系类型表添加 default_role 列(角色模板)
|
|
|
- ensureColumn("relationship_types", "default_role", "VARCHAR(20) DEFAULT NULL COMMENT '默认角色模板: parent/child'");
|
|
|
-
|
|
|
// 家庭成员表添加 role_override 列(替换旧 capability_role)
|
|
|
ensureColumn("family_members", "role_override", "VARCHAR(20) DEFAULT 'auto' COMMENT '角色覆盖: auto/parent/child/elderly'");
|
|
|
try {
|
|
|
@@ -2860,34 +2857,6 @@ log.info("已添加template_id列到tasks表");
|
|
|
log.warn("创建member_discount_configs表失败: {}", e.getMessage());
|
|
|
}
|
|
|
|
|
|
- try {
|
|
|
- Integer hasCap = jdbcTemplate.queryForObject(
|
|
|
- "SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'relationship_types' AND COLUMN_NAME = 'capability_role'",
|
|
|
- Integer.class);
|
|
|
- Integer hasDefault = jdbcTemplate.queryForObject(
|
|
|
- "SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'relationship_types' AND COLUMN_NAME = 'default_role'",
|
|
|
- Integer.class);
|
|
|
- if (hasCap != null && hasCap == 0) {
|
|
|
- if (hasDefault != null && hasDefault > 0) {
|
|
|
- jdbcTemplate.execute("ALTER TABLE relationship_types CHANGE COLUMN default_role capability_role VARCHAR(20) NOT NULL COMMENT '能力角色: parent/child'");
|
|
|
- log.info("已将relationship_types.default_role重命名为capability_role");
|
|
|
- } else {
|
|
|
- jdbcTemplate.execute("ALTER TABLE relationship_types ADD COLUMN capability_role VARCHAR(20) NOT NULL DEFAULT 'parent' COMMENT '能力角色: parent/child' AFTER type_name");
|
|
|
- log.info("已添加capability_role列到relationship_types表");
|
|
|
- }
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- log.warn("relationship_types capability_role 迁移失败: {}", e.getMessage());
|
|
|
- }
|
|
|
-
|
|
|
- // 确保capability_role有默认值(生产库该列NOT NULL无默认值,导致INSERT时Field doesn't have a default value错误)
|
|
|
- try {
|
|
|
- jdbcTemplate.execute("ALTER TABLE relationship_types MODIFY COLUMN capability_role VARCHAR(20) NOT NULL DEFAULT 'parent' COMMENT '能力角色: parent/child'");
|
|
|
- log.info("已修改relationship_types.capability_role添加默认值'parent'");
|
|
|
- } catch (Exception e) {
|
|
|
- log.warn("修改relationship_types.capability_role默认值失败: {}", e.getMessage());
|
|
|
- }
|
|
|
-
|
|
|
// ==================== 食材推荐指数 Phase: food_recommend_idx / food_recommend_idx_log ====================
|
|
|
try {
|
|
|
jdbcTemplate.execute("CREATE TABLE IF NOT EXISTS `food_recommend_idx` (" +
|
|
|
@@ -3140,8 +3109,8 @@ log.info("已添加template_id列到tasks表");
|
|
|
modifyColumnToText("guide_applications", "reject_reason", "拒绝原因");
|
|
|
// guide_application_records.remark
|
|
|
modifyColumnToText("guide_application_records", "remark", "备注/原因");
|
|
|
- // user_operation_log.description
|
|
|
- modifyColumnToText("user_operation_log", "description", "操作描述");
|
|
|
+ // user_operation_logs.description
|
|
|
+ modifyColumnToText("user_operation_logs", "description", "操作描述");
|
|
|
// follow_up.description, teacher_review
|
|
|
modifyColumnToText("follow_up", "description", "描述");
|
|
|
modifyColumnToText("follow_up", "teacher_review", "规划师点评");
|
|
|
@@ -3174,12 +3143,12 @@ log.info("已添加template_id列到tasks表");
|
|
|
// life_number_relationship.description, advice
|
|
|
modifyColumnToText("life_number_relationship", "description", "关系解读");
|
|
|
modifyColumnToText("life_number_relationship", "advice", "相处建议");
|
|
|
- // daily_health_checkin.remark
|
|
|
- modifyColumnToText("daily_health_checkin", "remark", "备注");
|
|
|
- // health_sleep_record.remark
|
|
|
- modifyColumnToText("health_sleep_record", "remark", "备注");
|
|
|
- // health_exercise_record.remark
|
|
|
- modifyColumnToText("health_exercise_record", "remark", "备注");
|
|
|
+ // health_checkins.note
|
|
|
+ modifyColumnToText("health_checkins", "note", "备注");
|
|
|
+ // sleep_record.remark
|
|
|
+ modifyColumnToText("sleep_record", "remark", "备注");
|
|
|
+ // exercise_record.remark
|
|
|
+ modifyColumnToText("exercise_record", "remark", "备注");
|
|
|
// finance_checkins.note
|
|
|
modifyColumnToText("finance_checkins", "note", "备注");
|
|
|
// guide_packages.description (old duplicate)
|
|
|
@@ -3187,18 +3156,12 @@ log.info("已添加template_id列到tasks表");
|
|
|
modifyColumnToText("assessment_appointments", "remark", "备注");
|
|
|
// withdrawal_requests.remark
|
|
|
modifyColumnToText("withdrawal_requests", "remark", "备注");
|
|
|
- // supply_settlements.remark
|
|
|
- modifyColumnToText("supply_settlements", "remark", "备注");
|
|
|
+ // supply_settlement.remark
|
|
|
+ modifyColumnToText("supply_settlement", "remark", "备注");
|
|
|
// content_sections.description
|
|
|
ensureColumn("content_sections", "description", "TEXT COMMENT '描述说明'");
|
|
|
// education_systems.description
|
|
|
modifyColumnToText("education_systems", "description", "描述");
|
|
|
- // dimension_config.description
|
|
|
- modifyColumnToText("dimension_config", "description", "描述");
|
|
|
- // energy_rules.description
|
|
|
- modifyColumnToText("energy_rules", "description", "规则描述");
|
|
|
- // team_goals.description
|
|
|
- modifyColumnToText("team_goals", "description", "团队描述");
|
|
|
// product_dimension_config.remark
|
|
|
modifyColumnToText("product_dimension_config", "remark", "备注");
|
|
|
// indicator_values.remark
|
|
|
@@ -5422,11 +5385,6 @@ try {
|
|
|
log.info("已创建social_circle_member表");
|
|
|
} catch (Exception e) { /* 表已存在忽略 */ }
|
|
|
|
|
|
- // 迁移89: relationship_types表添加分类和血亲字段
|
|
|
- ensureColumn("relationship_types", "category", "VARCHAR(50) DEFAULT 'social' COMMENT '关系分类: blood血亲/marriage姻亲/social社会关系'");
|
|
|
- ensureColumn("relationship_types", "is_blood_relation", "TINYINT DEFAULT 0 COMMENT '是否血亲关系: 1是0否'");
|
|
|
- ensureColumn("relationship_types", "is_immediate_family", "TINYINT DEFAULT 0 COMMENT '是否直系亲属: 1是0否'");
|
|
|
-
|
|
|
// 迁移96: 创建活动订单评价表
|
|
|
try {
|
|
|
jdbcTemplate.execute("CREATE TABLE IF NOT EXISTS review_orders (" +
|