Files
life-echo/api/migrations/fix_memoir_images_order_index.sql
Sully 2eb066dbec 把“章节正文 + 图片”从 chapters 单表/JSON 结构,重构为“章节 chapter + 段落 section + 图片 memoir_images 独立表”的新数据模型,同时联动修改接口、PDF 导出、异步任务、迁移脚本、测试,以及修复 Android 端聊天列表显示问题。 (#9)
* refactor: 表结构重构,新增段落section和图片image新表

* fix: fix android app import error

* refactor: 重构文件名

* fix: 优化提示词

* fix: 消息气泡显示位置异常问题

---------

Co-authored-by: yangshilin <2157598560@qq.com>
2026-03-13 11:12:10 +08:00

10 lines
454 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- 修复 memoir_images 同一章节内 order_index 重复:封面=0段落配图=1,2,3,...section.order_index+1
-- 仅更新有 section_id 的段落配图封面section_id 为空)保持 0。
-- 执行方式: psql -U <user> -d <database> -f api/migrations/fix_memoir_images_order_index.sql
UPDATE memoir_images mi
SET order_index = cs.order_index + 1
FROM chapter_sections cs
WHERE mi.section_id IS NOT NULL
AND mi.section_id = cs.id;