cmvr-visual/backend/alembic/versions/007_editable_automation.py
zhanghao 88cf14d794 feat: consolidate story studio and editable automatic production
Restructure backend and frontend modules; add story, library, and editor schema migrations.

Support editable automatic production, manual confirmation modes, account and user lifecycle management, compact container scrolling, consistent forms, and per-task result previews.

Update inference and TTS scheduling, deployment guidance, and regression coverage; remove obsolete standalone pages and temporary acceptance artifacts.
2026-11-14 14:07:26 +08:00

33 lines
1.4 KiB
Python

"""可恢复自动成片;仅追加字段,历史运行保留 legacy 语义。"""
from alembic import op
import sqlalchemy as sa
revision = '007'
down_revision = '006'
branch_labels = None
depends_on = None
def upgrade():
columns = {
'visual_drafts': [sa.Column('editor_manifest', sa.JSON(), nullable=True)],
'visual_workflow_runs': [
sa.Column('run_kind', sa.String(32), nullable=False, server_default='legacy'),
sa.Column('output_goal', sa.String(16), nullable=False, server_default='film'),
sa.Column('base_run_id', sa.String(32), nullable=True),
sa.Column('source_draft_version', sa.Integer(), nullable=True),
sa.Column('plan_snapshot', sa.JSON(), nullable=True),
sa.Column('result_manifest', sa.JSON(), nullable=True),
sa.Column('apply_state', sa.String(16), nullable=True)],
'visual_workflow_steps': [sa.Column(name, sa.JSON(), nullable=True) for name in ('recipe_json','resolved_input_json','result_json')],
}
bind = op.get_bind()
for table, fields in columns.items():
existing = {c['name'] for c in sa.inspect(bind).get_columns(table)}
for field in fields:
if field.name not in existing:
op.add_column(table, field)
def downgrade():
raise RuntimeError('Destructive downgrade unsupported; restore a verified joint checkpoint')