b9f43a0ede
Migrazione 020 con le due colonne su stations, campi in modello, schemi e
servizio (validatore http(s) come vision_worker_url), nuova route by-code
dichiarata prima di /{station_id}. Test di migrazione su e giu e di API.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
34 lines
1.1 KiB
Python
34 lines
1.1 KiB
Python
"""stations.camera_url e stations.camera_source (#72)
|
|
|
|
stations.camera_url: servizio camera della stazione (vs-gui o equivalente).
|
|
stations.camera_source: sorgente da chiedere al servizio, es. camera:<seriale>
|
|
o camera:folder.
|
|
|
|
Revision ID: 020_station_camera
|
|
Revises: 019_station_vision_worker
|
|
Create Date: 2026-10-15
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
revision: str = '020_station_camera'
|
|
down_revision: Union[str, None] = '019_station_vision_worker'
|
|
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('camera_url', sa.String(500), nullable=True))
|
|
batch.add_column(sa.Column('camera_source', sa.String(200), nullable=True))
|
|
|
|
|
|
def downgrade() -> None:
|
|
with op.batch_alter_table('stations') as batch:
|
|
batch.drop_column('camera_source')
|
|
batch.drop_column('camera_url')
|