95d643d6d8
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NABedeMX43pyXZbDNUgA5B
35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
"""stations.vision_worker_url e vision_results.worker_url (#45)
|
|
|
|
stations.vision_worker_url: worker di visione della stazione (NULL = centrale).
|
|
vision_results.worker_url: worker effettivamente chiamato per quel risultato.
|
|
|
|
Revision ID: 019_station_vision_worker
|
|
Revises: 018_task_loop_results
|
|
Create Date: 2026-10-11
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
revision: str = '019_station_vision_worker'
|
|
down_revision: Union[str, None] = '018_task_loop_results'
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# batch_alter_table come nelle migrazioni vicine: serve a SQLite
|
|
with op.batch_alter_table('stations') as batch:
|
|
batch.add_column(sa.Column('vision_worker_url', sa.String(500), nullable=True))
|
|
with op.batch_alter_table('vision_results') as batch:
|
|
batch.add_column(sa.Column('worker_url', sa.String(500), nullable=True))
|
|
|
|
|
|
def downgrade() -> None:
|
|
with op.batch_alter_table('vision_results') as batch:
|
|
batch.drop_column('worker_url')
|
|
with op.batch_alter_table('stations') as batch:
|
|
batch.drop_column('vision_worker_url')
|