- Updated the `iva_factor` field in the `InvoiceFinancials` model to use a numeric type with precision and scale. - Adjusted related frontend components and API interfaces to reflect the new numeric type for `iva_factor`. - Enhanced Alembic migration scripts to accommodate the schema changes, ensuring proper index management and data type conversions. These changes improve data integrity and consistency for financial calculations in invoices.
46 lines
1.6 KiB
Python
46 lines
1.6 KiB
Python
"""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 ###
|