"""add po_alt, pn, lot_batch to recebimento_registros Revision ID: 8f7c3e5a9b21 Revises: Create Date: 2026-01-29 13:20:00.000000 """ from alembic import op import sqlalchemy as sa # Revisão atual e anterior revision = '8f7c3e5a9b21' down_revision = '' branch_labels = None depends_on = None def upgrade(): # Usamos batch_alter_table p/ compatibilidade (SQLite etc.) with op.batch_alter_table('recebimento_registros', schema=None) as batch_op: batch_op.add_column(sa.Column('po_alt', sa.String(length=60), nullable=True)) batch_op.add_column(sa.Column('pn', sa.String(length=120), nullable=True)) batch_op.add_column(sa.Column('lot_batch', sa.String(length=120), nullable=True)) # Se desejar índices (opcionais), descomente: # batch_op.create_index('ix_receb_po_alt', ['po_alt']) # batch_op.create_index('ix_receb_pn', ['pn']) # batch_op.create_index('ix_receb_lot_batch', ['lot_batch']) def downgrade(): with op.batch_alter_table('recebimento_registros', schema=None) as batch_op: # Se criou índices acima, primeiro drope-os: # batch_op.drop_index('ix_receb_lot_batch') # batch_op.drop_index('ix_receb_pn') # batch_op.drop_index('ix_receb_po_alt') batch_op.drop_column('lot_batch') batch_op.drop_column('pn') batch_op.drop_column('po_alt')