"""sale payment method and surcharge

Revision ID: 4332b67bf735
Revises: 879c29caee90
Create Date: 2026-05-09 08:54:06.782138

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '4332b67bf735'
down_revision = '879c29caee90'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('sales', schema=None) as batch_op:
        batch_op.add_column(sa.Column('payment_method_id', sa.Integer(), nullable=True))
        batch_op.add_column(sa.Column('surcharge', sa.Numeric(precision=12, scale=2), nullable=False))
        batch_op.create_index(batch_op.f('ix_sales_payment_method_id'), ['payment_method_id'], unique=False)
        batch_op.create_foreign_key(None, 'payment_methods', ['payment_method_id'], ['id'])

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('sales', schema=None) as batch_op:
        batch_op.drop_constraint(None, type_='foreignkey')
        batch_op.drop_index(batch_op.f('ix_sales_payment_method_id'))
        batch_op.drop_column('surcharge')
        batch_op.drop_column('payment_method_id')

    # ### end Alembic commands ###
