[add] migration script

This commit is contained in:
Mark
2026-01-08 19:16:55 +08:00
parent c5dd09cf50
commit 5cb7962593

View File

@@ -0,0 +1,42 @@
"""202601081915
Revision ID: 52ebaf4ad3fb
Revises: a959b201c507
Create Date: 2026-01-08 19:15:43.830726
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '52ebaf4ad3fb'
down_revision: Union[str, None] = 'a959b201c507'
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.create_table('conversation_details',
sa.Column('id', sa.UUID(), nullable=False),
sa.Column('conversation_id', sa.UUID(), nullable=True),
sa.Column('theme', sa.String(), nullable=True, comment='会话主题'),
sa.Column('theme_intro', sa.String(), nullable=True, comment='主题介绍'),
sa.Column('summary', sa.String(), nullable=True, comment='会话摘要'),
sa.Column('takeaways', sa.JSON(), nullable=True, comment='会话要点'),
sa.Column('info_score', sa.Integer(), nullable=True, comment='会话信息量评分'),
sa.ForeignKeyConstraint(['conversation_id'], ['conversations.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_conversation_details_id'), 'conversation_details', ['id'], unique=False)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_conversation_details_id'), table_name='conversation_details')
op.drop_table('conversation_details')
# ### end Alembic commands ###