"""add gst payment fields

Revision ID: 58a5ce7cf557
Revises: 38c25f921132
Create Date: 2026-04-27 00:02:09.990311

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '58a5ce7cf557'
down_revision = '38c25f921132'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('gst_settlement', schema=None) as batch_op:
        batch_op.add_column(sa.Column('payment_date', sa.Date(), nullable=True))
        batch_op.add_column(sa.Column('paid_from_ledger_id', sa.Integer(), nullable=True))
        batch_op.add_column(sa.Column('challan_no', sa.String(length=100), nullable=True))
        batch_op.add_column(sa.Column('challan_date', sa.Date(), nullable=True))
        batch_op.add_column(sa.Column('payment_reference_no', sa.String(length=100), nullable=True))
        batch_op.add_column(sa.Column('payment_remarks', sa.Text(), nullable=True))
        batch_op.add_column(sa.Column('paid_amount', sa.Numeric(precision=18, scale=2), nullable=False))
        batch_op.create_index(batch_op.f('ix_gst_settlement_paid_from_ledger_id'), ['paid_from_ledger_id'], unique=False)
        batch_op.create_foreign_key(None, 'account_ledger', ['paid_from_ledger_id'], ['id'])

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('gst_settlement', schema=None) as batch_op:
        batch_op.drop_constraint(None, type_='foreignkey')
        batch_op.drop_index(batch_op.f('ix_gst_settlement_paid_from_ledger_id'))
        batch_op.drop_column('paid_amount')
        batch_op.drop_column('payment_remarks')
        batch_op.drop_column('payment_reference_no')
        batch_op.drop_column('challan_date')
        batch_op.drop_column('challan_no')
        batch_op.drop_column('paid_from_ledger_id')
        batch_op.drop_column('payment_date')

    # ### end Alembic commands ###
