Files
life-echo/api/migrations
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
..

数据库迁移

说明

  • sync_schema_to_models.sql:与当前 api/database/models.py 保持一致的幂等迁移脚本,部署工作流会在每次部署后自动执行。可重复执行,已存在的表/列会跳过。
  • 其余 add_*.sql 为历史增量迁移,可按需单独执行;若已运行过 sync_schema_to_models.sql,通常不必再跑。

手动执行

# 从项目根目录
psql -U <user> -d <database> -f api/migrations/sync_schema_to_models.sql

若使用与 docker-compose 默认不同的数据库用户/库名,可在 GitHub 仓库中配置 SecretsMIGRATION_DB_USERMIGRATION_DB_NAME,工作流将用其执行迁移。