[add] migration script

This commit is contained in:
Mark
2026-03-10 14:51:48 +08:00
parent 8a4d58c520
commit e81faebf69
2 changed files with 35 additions and 1 deletions

View File

@@ -52,7 +52,7 @@ class EndUser(Base):
memory_insight_updated_at = Column(DateTime, nullable=True, comment="洞察报告最后更新时间")
# RAG存储模式专用字段 - RAG Storage Mode Fields
storage_type = Column(String, nullable=True, default="neo4j", comment="存储模式类型: neo4j / rag")
# storage_type = Column(String, nullable=True, default="neo4j", comment="存储模式类型: neo4j / rag")
rag_tags = Column(Text, nullable=True, comment="RAG模式下提取的标签列表JSON格式")
rag_personas = Column(Text, nullable=True, comment="RAG模式下提取的人物形象列表JSON格式")
rag_summary_updated_at = Column(DateTime, nullable=True, comment="RAG摘要/标签/人物形象最后更新时间")

View File

@@ -0,0 +1,34 @@
"""202603101453
Revision ID: fb834419b18f
Revises: 1ac07dc7366f
Create Date: 2026-03-10 14:46:48.038643
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = 'fb834419b18f'
down_revision: Union[str, None] = '1ac07dc7366f'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('end_users', sa.Column('rag_tags', sa.Text(), nullable=True, comment='RAG模式下提取的标签列表JSON格式'))
op.add_column('end_users', sa.Column('rag_personas', sa.Text(), nullable=True, comment='RAG模式下提取的人物形象列表JSON格式'))
op.add_column('end_users', sa.Column('rag_summary_updated_at', sa.DateTime(), nullable=True, comment='RAG摘要/标签/人物形象最后更新时间'))
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('end_users', 'rag_summary_updated_at')
op.drop_column('end_users', 'rag_personas')
op.drop_column('end_users', 'rag_tags')
# ### end Alembic commands ###