5 Commits 0ad71c0ae0 ... 2b9c0d10f6

Author SHA1 Message Date
  Xiaogang Liao 2b9c0d10f6 Merge branch 'cfclub' of http://git.iwintrue.com/liaoxg/cfc into cfclub 2 weeks ago
  Xiaogang Liao 10d1ca63c2 fix(db): 迁移323-325移至runSystemMigrations,修复因早返回导致永不执行的happened_at/article_id问题 2 weeks ago
  Xiaogang Liao 6bff9e9094 chore: update .last_build_commit for frontend v1.0.1428 [skip ci] 2 weeks ago
  Xiaogang Liao cfb0a3ba4a chore: auto bump version and changelog [skip ci] 2 weeks ago
  Xiaogang Liao e08f86fb23 chore(langgraph): 容器内存限制 4g 提升至 6g,缓解 embedding 同步高峰 OOM 风险 2 weeks ago

+ 29 - 26
cfc-backend/src/main/java/com/etotem/cfc/config/DatabaseInitializer.java

@@ -11130,6 +11130,35 @@ log.info("迁移298: 已为无 openid 的 child 账号补齐 family_members 记
 
         // 迁移300: profile_snapshot 增加 quiz_summary 列(答题认知雷达汇总)
         ensureColumn("profile_snapshot", "quiz_summary", "JSON DEFAULT NULL COMMENT '答题认知雷达汇总'");
+
+        // 迁移323-325: 原误置于 seedGutFloraFingerprints 早返回(return)之后,指纹数据存在时永不执行;
+        // 现移至 runSystemMigrations 无条件执行(octopus_effect_record.happened_at / article_reading_records 回填与补列)
+        // 迁移323: octopus_effect_record 添加 happened_at 列(成效发生时间)
+        try {
+            jdbcTemplate.execute("ALTER TABLE octopus_effect_record ADD COLUMN happened_at DATETIME COMMENT '成效发生时间'");
+            log.info("迁移323: octopus_effect_record.happened_at 列已添加");
+        } catch (Exception e) {
+            // 列已存在,忽略
+            log.warn("迁移323: octopus_effect_record.happened_at 列已存在或添加失败: {}", e.getMessage());
+        }
+
+        // 迁移324: 回填 article_reading_records 表中 article_id 为 NULL 的老记录
+        // 通过 task 表关联恢复:record.task_id → task.source_type='article' → task.source_id
+        try {
+            int updated = jdbcTemplate.update(
+                    "UPDATE article_reading_records r " +
+                    "LEFT JOIN tasks t ON r.task_id = t.id AND t.source_type = 'article' " +
+                    "SET r.article_id = t.source_id " +
+                    "WHERE r.article_id IS NULL AND t.id IS NOT NULL AND t.source_id IS NOT NULL"
+            );
+            log.info("迁移324: 已回填 article_reading_records.article_id {} 条记录", updated);
+        } catch (Exception e) {
+            log.warn("迁移324: 回填 article_reading_records.article_id 失败: {}", e.getMessage());
+        }
+
+        // 迁移325: article_reading_records 添加 reading_completed 列(阅读达标后标记,用于推荐过滤)
+        ensureColumn("article_reading_records", "reading_completed", "TINYINT DEFAULT 0 COMMENT '是否已阅读达标(达到最低时长阈值)'");
+
     }
 
     /**
@@ -11206,32 +11235,6 @@ log.info("迁移298: 已为无 openid 的 child 账号补齐 family_members 记
             log.warn("迁移312: 写入 gut_flora 指纹规则失败: {}", e.getMessage());
         }
 
-        // 迁移313: octopus_effect_record 添加 happened_at 列(成效发生时间)
-        try {
-            jdbcTemplate.execute("ALTER TABLE octopus_effect_record ADD COLUMN happened_at DATETIME COMMENT '成效发生时间'");
-            log.info("迁移313: octopus_effect_record.happened_at 列已添加");
-        } catch (Exception e) {
-            // 列已存在,忽略
-            log.warn("迁移313: octopus_effect_record.happened_at 列已存在或添加失败: {}", e.getMessage());
-        }
-
-        // 迁移314: 回填 article_reading_records 表中 article_id 为 NULL 的老记录
-        // 通过 task 表关联恢复:record.task_id → task.source_type='article' → task.source_id
-        try {
-            int updated = jdbcTemplate.update(
-                    "UPDATE article_reading_records r " +
-                    "LEFT JOIN tasks t ON r.task_id = t.id AND t.source_type = 'article' " +
-                    "SET r.article_id = t.source_id " +
-                    "WHERE r.article_id IS NULL AND t.id IS NOT NULL AND t.source_id IS NOT NULL"
-            );
-            log.info("迁移314: 已回填 article_reading_records.article_id {} 条记录", updated);
-        } catch (Exception e) {
-            log.warn("迁移314: 回填 article_reading_records.article_id 失败: {}", e.getMessage());
-        }
-
-        // 迁移315: article_reading_records 添加 reading_completed 列(阅读达标后标记,用于推荐过滤)
-        ensureColumn("article_reading_records", "reading_completed", "TINYINT DEFAULT 0 COMMENT '是否已阅读达标(达到最低时长阈值)'");
-
         // 迁移316: 创建 recommendation_rules 表(统一推荐规则配置)
         try {
             jdbcTemplate.execute("CREATE TABLE IF NOT EXISTS recommendation_rules (" +

+ 1 - 1
cfc-langgraph/docker-compose.yml

@@ -44,7 +44,7 @@ services:
       - cfc-net
     restart: unless-stopped
     # 内存硬限制:防止 ChromaDB/搜索任务异常膨胀吃满宿主机内存导致整机 OOM
-    mem_limit: 4g
+    mem_limit: 6g
     healthcheck:
       test: ["CMD", "python", "-c", "import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://localhost:9000/health', timeout=5).status==200 else 1)"]
       interval: 30s