|
@@ -9009,6 +9009,41 @@ private void runMigration100() {
|
|
|
// 迁移251: 健康饮食组挂载 报告管理/报告审核/应季食材(《角色权限与菜单归类整合方案》第二部分,幂等)
|
|
// 迁移251: 健康饮食组挂载 报告管理/报告审核/应季食材(《角色权限与菜单归类整合方案》第二部分,幂等)
|
|
|
migrateHealthMenuMount();
|
|
migrateHealthMenuMount();
|
|
|
|
|
|
|
|
|
|
+ // 迁移252: 创建用户画像表
|
|
|
|
|
+ try {
|
|
|
|
|
+ jdbcTemplate.execute("CREATE TABLE IF NOT EXISTS profile_snapshot (" +
|
|
|
|
|
+ "id BIGINT AUTO_INCREMENT PRIMARY KEY, " +
|
|
|
|
|
+ "member_id BIGINT NOT NULL UNIQUE, " +
|
|
|
|
|
+ "dimension_scores JSON DEFAULT NULL, " +
|
|
|
|
|
+ "body_metrics JSON DEFAULT NULL, " +
|
|
|
|
|
+ "mind_metrics JSON DEFAULT NULL, " +
|
|
|
|
|
+ "wisdom_metrics JSON DEFAULT NULL, " +
|
|
|
|
|
+ "action_metrics JSON DEFAULT NULL, " +
|
|
|
|
|
+ "wealth_metrics JSON DEFAULT NULL, " +
|
|
|
|
|
+ "problem_domains VARCHAR(500) DEFAULT NULL, " +
|
|
|
|
|
+ "computed_at DATETIME DEFAULT NULL, " +
|
|
|
|
|
+ "updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, " +
|
|
|
|
|
+ "INDEX idx_member_id (member_id)" +
|
|
|
|
|
+ ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4");
|
|
|
|
|
+ log.info("已创建profile_snapshot表");
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.warn("创建profile_snapshot表可能已存在: {}", e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ jdbcTemplate.execute("CREATE TABLE IF NOT EXISTS profile_history (" +
|
|
|
|
|
+ "id BIGINT AUTO_INCREMENT PRIMARY KEY, " +
|
|
|
|
|
+ "member_id BIGINT NOT NULL, " +
|
|
|
|
|
+ "snapshot_date DATE NOT NULL, " +
|
|
|
|
|
+ "all_metrics JSON NOT NULL, " +
|
|
|
|
|
+ "created_at DATETIME DEFAULT CURRENT_TIMESTAMP, " +
|
|
|
|
|
+ "INDEX idx_member_date (member_id, snapshot_date)" +
|
|
|
|
|
+ ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4");
|
|
|
|
|
+ log.info("已创建profile_history表");
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.warn("创建profile_history表可能已存在: {}", e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|