"""simplify_benefits_drop_transactions_and_balance

Revision ID: 10be32b8efd7
Revises: 9867676a4662
Create Date: 2026-03-16 12:52:48.592744

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

revision: str = '10be32b8efd7'
down_revision: Union[str, None] = '9867676a4662'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('benefit_transactions')
    op.drop_column('benefits', 'remaining_balance')
    op.drop_column('benefits', 'total_amount')
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('benefits', sa.Column('total_amount', sa.INTEGER(), autoincrement=False, nullable=False))
    op.add_column('benefits', sa.Column('remaining_balance', sa.INTEGER(), autoincrement=False, nullable=False))
    op.create_table('benefit_transactions',
    sa.Column('id', sa.VARCHAR(), autoincrement=False, nullable=False),
    sa.Column('benefit_id', sa.VARCHAR(), autoincrement=False, nullable=False),
    sa.Column('employee_id', sa.VARCHAR(), autoincrement=False, nullable=False),
    sa.Column('transaction_date', sa.DATE(), autoincrement=False, nullable=False),
    sa.Column('description', sa.TEXT(), autoincrement=False, nullable=False),
    sa.Column('debit', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('credit', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('balance', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('created_at', postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=False),
    sa.ForeignKeyConstraint(['benefit_id'], ['benefits.id'], name='benefit_transactions_benefit_id_fkey', ondelete='CASCADE'),
    sa.ForeignKeyConstraint(['employee_id'], ['employees.id'], name='benefit_transactions_employee_id_fkey', ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id', name='benefit_transactions_pkey')
    )
    # ### end Alembic commands ###
