Files
MuMuAINovel/backend/alembic/sqlite/versions/20260212_1007_d887fd1a30a6_新增角色状态字段.py

36 lines
1.2 KiB
Python

"""新增角色状态字段
Revision ID: d887fd1a30a6
Revises: 642c76fc69d4
Create Date: 2026-02-12 10:07:13.617928
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = 'd887fd1a30a6'
down_revision: Union[str, None] = '642c76fc69d4'
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! ###
with op.batch_alter_table('characters', schema=None) as batch_op:
batch_op.add_column(sa.Column('status', sa.String(length=20), nullable=True, comment='状态:active/deceased/missing/retired/destroyed'))
batch_op.add_column(sa.Column('status_changed_chapter', sa.Integer(), nullable=True, comment='状态变更的章节号'))
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('characters', schema=None) as batch_op:
batch_op.drop_column('status_changed_chapter')
batch_op.drop_column('status')
# ### end Alembic commands ###