From 3f4c2d7796f6589169eb0cef2064e3b498b92c8e Mon Sep 17 00:00:00 2001 From: Mark Date: Sat, 20 Dec 2025 15:27:47 +0800 Subject: [PATCH] [add] migration script --- .../versions/626abf154a6a_202512201526.py | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 api/migrations/versions/626abf154a6a_202512201526.py diff --git a/api/migrations/versions/626abf154a6a_202512201526.py b/api/migrations/versions/626abf154a6a_202512201526.py new file mode 100644 index 00000000..7d89766e --- /dev/null +++ b/api/migrations/versions/626abf154a6a_202512201526.py @@ -0,0 +1,38 @@ +"""202512201526 + +Revision ID: 626abf154a6a +Revises: 70e94dd4a8d1 +Create Date: 2025-12-20 15:26:50.634470 + +""" +from typing import Sequence, Union + +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision: str = '626abf154a6a' +down_revision: Union[str, None] = '70e94dd4a8d1' +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('data_config', sa.Column('emotion_enabled', sa.Boolean(), nullable=True, comment='是否启用情绪提取')) + op.add_column('data_config', sa.Column('emotion_model_id', sa.String(), nullable=True, comment='情绪分析专用模型ID')) + op.add_column('data_config', sa.Column('emotion_extract_keywords', sa.Boolean(), nullable=True, comment='是否提取情绪关键词')) + op.add_column('data_config', sa.Column('emotion_min_intensity', sa.Float(), nullable=True, comment='最小情绪强度阈值')) + op.add_column('data_config', sa.Column('emotion_enable_subject', sa.Boolean(), nullable=True, comment='是否启用主体分类')) + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.drop_column('data_config', 'emotion_enable_subject') + op.drop_column('data_config', 'emotion_min_intensity') + op.drop_column('data_config', 'emotion_extract_keywords') + op.drop_column('data_config', 'emotion_model_id') + op.drop_column('data_config', 'emotion_enabled') + # ### end Alembic commands ###