修复:CI 部署环境与 ref 错配、迁移碎片化、图片意图 source_span、章节物化脏版式、会话历史与本地语音不一致
新增:TTS 上传 COS 与分片、章节 reading_segments 物化与快照、markdown 清洗、会话消息 repository、语音 store 重构与相关测试
This commit is contained in:
@@ -2,7 +2,13 @@
|
||||
|
||||
单一迁移:pgvector + 当前全部 ORM 表(含 conversations.deleted_at 软删除);并补充 models 未声明的
|
||||
story_image_intents.asset_id → assets 外键,以及每个 story 仅一条 primary intent 的唯一索引。
|
||||
chapters 含 story 物化字段:markdown_compose_dirty、markdown_composed_at(随 ORM 一并 create_all)。
|
||||
chapters 含 story 物化字段:markdown_compose_dirty、markdown_composed_at、reading_segments_json
|
||||
(阅读片段快照,随 ORM 一并 create_all)。
|
||||
|
||||
已并入原 0002(stories-first:无 chapter_sections / memoir_images.section_id)与原 0003(segments.tts_audio_urls)
|
||||
的语义:新库仅由当前 ORM 建表即可,无需后续 ALTER。
|
||||
segments.audio_duration_seconds(语音条时长秒数,历史 API / Redis 回填)由 ORM 一并 create_all,无独立迁移。
|
||||
story_image_intents 无 source_span(主图回填在正文末尾,意图仅存 caption / prompt_brief 等)。
|
||||
|
||||
新库 / 删库重来:`alembic upgrade head`。
|
||||
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
"""drop chapter_sections + memoir_images.section_id (stories-first)
|
||||
|
||||
Revision ID: 0002_drop_chapter_sections
|
||||
Revises: 0001_initial
|
||||
"""
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
|
||||
revision: str = "0002_drop_chapter_sections"
|
||||
down_revision: Union[str, None] = "0001_initial"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# memoir_images.section_id -> chapter_sections 必须先解除,再删表
|
||||
op.execute(
|
||||
"ALTER TABLE memoir_images DROP CONSTRAINT IF EXISTS memoir_images_section_id_fkey"
|
||||
)
|
||||
op.execute("ALTER TABLE memoir_images DROP COLUMN IF EXISTS section_id")
|
||||
op.execute("DROP TABLE IF EXISTS chapter_sections CASCADE")
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
raise NotImplementedError(
|
||||
"0002 为破坏性迁移:不恢复 chapter_sections;请从备份还原数据库。"
|
||||
)
|
||||
Reference in New Issue
Block a user