feat: add batch_id/target_label to sessions and batch launch endpoint
- Add batch_id (UUID, nullable, indexed) and target_label (String 255, nullable) columns to the Session model - Manual Alembic migration 6e8128ef2aa8 applies both columns - POST /sessions/batch creates one session per target for maintenance flows; rejects empty targets (422) and non-maintenance trees (400) - SessionResponse schema exposes batch_id and target_label - 3 new integration tests, all 540 tests pass Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
"""add batch_id and target_label to sessions
|
||||
|
||||
Revision ID: 6e8128ef2aa8
|
||||
Revises: 5812e7df852f
|
||||
Create Date: 2026-02-17
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '6e8128ef2aa8'
|
||||
down_revision = '5812e7df852f'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.add_column('sessions', sa.Column('batch_id', postgresql.UUID(as_uuid=True), nullable=True))
|
||||
op.add_column('sessions', sa.Column('target_label', sa.String(255), nullable=True))
|
||||
op.create_index('ix_sessions_batch_id', 'sessions', ['batch_id'])
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_index('ix_sessions_batch_id', table_name='sessions')
|
||||
op.drop_column('sessions', 'target_label')
|
||||
op.drop_column('sessions', 'batch_id')
|
||||
Reference in New Issue
Block a user