"""add suspended_intent / resumable_step_code / resumable_slots_json (Спринт 6a, блок C) Revision ID: e1a4f7c83b29 Revises: d9b612a04e75 Create Date: 2026-04-25 12:30:00.000000 При hard-handoff из ветки со state machine (через `[INTENT_CHANGE: ...]`) текущий сценарий запоминается в `suspended_intent` + `resumable_step_code` + `resumable_slots_json`. Если на следующих репликах роутер возвращает intent = suspended_intent — восстанавливаем state и очищаем эти поля. v2 §4.4. """ from typing import Sequence, Union from alembic import op import sqlalchemy as sa revision: str = 'e1a4f7c83b29' down_revision: Union[str, None] = 'd9b612a04e75' branch_labels: Union[str, Sequence[str], None] = None depends_on: Union[str, Sequence[str], None] = None def upgrade() -> None: with op.batch_alter_table('thread_state', recreate='always') as batch: batch.add_column(sa.Column('suspended_intent', sa.String(length=50), nullable=True)) batch.add_column(sa.Column('resumable_step_code', sa.String(length=50), nullable=True)) batch.add_column(sa.Column('resumable_slots_json', sa.Text(), nullable=True)) def downgrade() -> None: with op.batch_alter_table('thread_state', recreate='always') as batch: batch.drop_column('resumable_slots_json') batch.drop_column('resumable_step_code') batch.drop_column('suspended_intent')