"""iva_factor

Revision ID: bccb7f8986c7
Revises: 9f3c2d1b7a11
Create Date: 2026-03-23 09:44:02.275257

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = 'bccb7f8986c7'
down_revision: Union[str, Sequence[str], None] = '9f3c2d1b7a11'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    """Upgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_public_carta_porte_code'), table_name='carta_porte_codes')
    op.create_index(op.f('ix_public_carta_porte_codes_code'), 'carta_porte_codes', ['code'], unique=False, schema='public')
    op.alter_column('invoice_financials', 'iva_factor',
               existing_type=sa.VARCHAR(length=10),
               type_=sa.Numeric(precision=23, scale=8),
               postgresql_using='iva_factor::numeric(23,8)',
               existing_nullable=True,
               schema='a76')
    # ### end Alembic commands ###


def downgrade() -> None:
    """Downgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('invoice_financials', 'iva_factor',
               existing_type=sa.Numeric(precision=23, scale=8),
               type_=sa.VARCHAR(length=10),
               existing_nullable=True,
               schema='a76')
    op.drop_index(op.f('ix_public_carta_porte_codes_code'), table_name='carta_porte_codes', schema='public')
    op.create_index(op.f('ix_public_carta_porte_code'), 'carta_porte_codes', ['code'], unique=False)
    # ### end Alembic commands ###
