"""添加角色心理状态追踪字段

Revision ID: d4d253e3f4c6
Revises: 421237957b27
Create Date: 2026-02-12 12:44:20.266679

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = 'd4d253e3f4c6'
down_revision: Union[str, None] = '421237957b27'
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('characters', sa.Column('status', sa.String(length=20), nullable=True, comment='状态：active/deceased/missing/retired/destroyed'))
    op.add_column('characters', sa.Column('status_changed_chapter', sa.Integer(), nullable=True, comment='状态变更的章节号'))
    op.add_column('characters', sa.Column('current_state', sa.Text(), nullable=True, comment='角色当前心理状态（由分析自动更新）'))
    op.add_column('characters', sa.Column('state_updated_chapter', sa.Integer(), nullable=True, comment='心理状态最后更新的章节号'))
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('characters', 'state_updated_chapter')
    op.drop_column('characters', 'current_state')
    op.drop_column('characters', 'status_changed_chapter')
    op.drop_column('characters', 'status')
    # ### end Alembic commands ###