feature:新增角色/组织状态追踪系统,章节分析自动更新角色存活状态、心理状态及组织成员变动

This commit is contained in:
xiamuceer-j
2026-02-12 12:38:52 +08:00
parent 5bb0b034e8
commit 58ff24c3d1
7 changed files with 953 additions and 12 deletions
@@ -0,0 +1,36 @@
"""添加角色心理状态追踪字段
Revision ID: 642c76fc69d4
Revises: 927bcb55b756
Create Date: 2026-02-12 09:22:09.946923
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '642c76fc69d4'
down_revision: Union[str, None] = '927bcb55b756'
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('current_state', sa.Text(), nullable=True, comment='角色当前心理状态(由分析自动更新)'))
batch_op.add_column(sa.Column('state_updated_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('state_updated_chapter')
batch_op.drop_column('current_state')
# ### end Alembic commands ###
@@ -0,0 +1,36 @@
"""新增角色状态字段
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 ###