"""add insert_method and connection fields to translation tables

Revision ID: c0d1e2f3a4b5
Revises: f2b3c4d5e6f7
Create Date: 2026-06-10 14:45:00
"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = 'c0d1e2f3a4b5'
down_revision: Union[str, None] = '351afb8f961a'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    # Add insert_method and connection_id to translation_jobs
    op.add_column('translation_jobs', sa.Column('insert_method', sa.String(), nullable=False, server_default='sqllab'))
    op.add_column('translation_jobs', sa.Column('connection_id', sa.String(), nullable=True))

    # Add insert_method and connection_snapshot to translation_runs
    op.add_column('translation_runs', sa.Column('insert_method', sa.String(), nullable=True))
    op.add_column('translation_runs', sa.Column('connection_snapshot', sa.JSON(), nullable=True))


def downgrade() -> None:
    op.drop_column('translation_runs', 'connection_snapshot')
    op.drop_column('translation_runs', 'insert_method')
    op.drop_column('translation_jobs', 'connection_id')
    op.drop_column('translation_jobs', 'insert_method')
