feat(vision): il grafo vive sul task, la quota nomina la sua uscita
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
"""the vision graph lives on the task, and the quote names its output
|
||||
|
||||
`xf_compare` was a typo for `dxf_compare`. No row uses either value yet, so
|
||||
renaming costs one statement here; from the first saved task onwards it would
|
||||
be a data migration and the typo would already be in the public API.
|
||||
|
||||
Revision ID: 011_vision_graph
|
||||
Revises: 010_meas_authorisation
|
||||
Create Date: 2026-08-16
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
revision: str = '011_vision_graph'
|
||||
down_revision: Union[str, None] = '010_meas_authorisation'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
OLD_TYPES = ('note', 'measure', 'drawing', 'xf_compare', 'camera_measure')
|
||||
NEW_TYPES = ('note', 'measure', 'drawing', 'dxf_compare', 'camera_measure')
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
with op.batch_alter_table('recipe_tasks') as batch:
|
||||
batch.add_column(sa.Column('vision_json', sa.JSON(), nullable=True))
|
||||
batch.alter_column(
|
||||
'task_type',
|
||||
existing_type=sa.Enum(*OLD_TYPES, name='task_type_enum'),
|
||||
type_=sa.Enum(*NEW_TYPES, name='task_type_enum'),
|
||||
existing_nullable=False,
|
||||
existing_server_default='note',
|
||||
)
|
||||
|
||||
with op.batch_alter_table('recipe_subtasks') as batch:
|
||||
batch.add_column(
|
||||
sa.Column('vision_output', sa.String(length=120), nullable=True)
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
with op.batch_alter_table('recipe_subtasks') as batch:
|
||||
batch.drop_column('vision_output')
|
||||
|
||||
with op.batch_alter_table('recipe_tasks') as batch:
|
||||
batch.alter_column(
|
||||
'task_type',
|
||||
existing_type=sa.Enum(*NEW_TYPES, name='task_type_enum'),
|
||||
type_=sa.Enum(*OLD_TYPES, name='task_type_enum'),
|
||||
existing_nullable=False,
|
||||
existing_server_default='note',
|
||||
)
|
||||
batch.drop_column('vision_json')
|
||||
Reference in New Issue
Block a user