"""reference images, with their provenance A reference image without provenance is a trap: the graph is re-run months later, different numbers come out, and there is no way to tell an updated engine from a moved lens. `expected_json` holds what the graph is supposed to produce on this image. It is what makes a regression run possible after a VisionSuite upgrade - the safety net that makes bumping the submodule sustainable with an engine on two hosts. Revision ID: 013_reference_images Revises: 012_vision_results Create Date: 2026-08-16 """ from typing import Sequence, Union from alembic import op import sqlalchemy as sa revision: str = '013_reference_images' down_revision: Union[str, None] = '012_vision_results' branch_labels: Union[str, Sequence[str], None] = None depends_on: Union[str, Sequence[str], None] = None def upgrade() -> None: op.create_table( 'vision_reference_images', sa.Column('id', sa.Integer(), primary_key=True, autoincrement=True), sa.Column('task_id', sa.Integer(), sa.ForeignKey('recipe_tasks.id'), nullable=False, index=True), sa.Column('path', sa.String(length=500), nullable=False), sa.Column('station_id', sa.Integer(), sa.ForeignKey('stations.id'), nullable=True), sa.Column('device_code', sa.String(length=100), nullable=True), sa.Column('calibration_snapshot', sa.JSON(), nullable=True), sa.Column('engine_version', sa.String(length=64), nullable=True), sa.Column('note', sa.String(length=500), nullable=True), sa.Column('expected_json', sa.JSON(), nullable=True), sa.Column('acquired_at', sa.DateTime(), nullable=False, server_default=sa.func.now()), mysql_engine='InnoDB', mysql_charset='utf8mb4', ) def downgrade() -> None: op.drop_table('vision_reference_images')