From 08416d6cadccb9e5434a2ec37c9b38b24c43a89d Mon Sep 17 00:00:00 2001 From: AlexeerCT Date: Thu, 8 Jan 2026 21:12:31 -0600 Subject: [PATCH] Refactor Part model and related components - Updated the Part model in models.py to improve readability and maintainability by organizing imports and formatting. - Enhanced relationships in the Part model for better clarity. - Modified main.py to streamline imports for parts and related models. - Adjusted partForm.svelte to correctly reference properties from inv_data and fa_data. - Updated +page.svelte to fix the import path for DataTable and refine data handling. - Changed edit/[[id]]/+page.svelte to enforce type safety for the 'type' variable. --- ...2f4f3ca0_add_material_type_key_to_parts.py | 2658 ----------------- backend/api/v1/modules/a76/parts/models.py | 60 +- backend/main.py | 20 +- .../dashboard/goods/parts/partForm.svelte | 12 +- .../routes/dashboard/goods/parts/+page.svelte | 14 +- .../goods/parts/edit/[[id]]/+page.svelte | 2 +- 6 files changed, 69 insertions(+), 2697 deletions(-) delete mode 100644 backend/alembic/versions/57472f4f3ca0_add_material_type_key_to_parts.py diff --git a/backend/alembic/versions/57472f4f3ca0_add_material_type_key_to_parts.py b/backend/alembic/versions/57472f4f3ca0_add_material_type_key_to_parts.py deleted file mode 100644 index 7e6c7705..00000000 --- a/backend/alembic/versions/57472f4f3ca0_add_material_type_key_to_parts.py +++ /dev/null @@ -1,2658 +0,0 @@ -"""add material_type_key to parts - -Revision ID: 57472f4f3ca0 -Revises: 7937209f9718 -Create Date: 2026-01-07 15:27:22.443152 - -""" -from typing import Sequence, Union - -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision: str = '57472f4f3ca0' -down_revision: Union[str, Sequence[str], None] = '7937209f9718' -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.create_table('tenants', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('name', sa.String(length=255), nullable=False), - sa.Column('slug', sa.String(length=100), nullable=False), - sa.Column('type', sa.Enum('SHARED', 'DEDICATED', name='tenanttype'), nullable=False), - sa.Column('keycloak_realm', sa.String(length=255), nullable=False), - sa.Column('db_config', sa.Text(), nullable=True), - sa.Column('contact_name', sa.String(length=255), nullable=True), - sa.Column('contact_email', sa.String(length=255), nullable=True), - sa.Column('contact_phone', sa.String(length=50), nullable=True), - sa.Column('is_active', sa.Boolean(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.PrimaryKeyConstraint('id'), - schema='core' - ) - op.create_index(op.f('ix_core_tenants_id'), 'tenants', ['id'], unique=False, schema='core') - op.create_index(op.f('ix_core_tenants_name'), 'tenants', ['name'], unique=False, schema='core') - op.create_index(op.f('ix_core_tenants_slug'), 'tenants', ['slug'], unique=True, schema='core') - op.create_table('company', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('name', sa.String(length=255), nullable=True), - sa.Column('rfc', sa.String(length=30), nullable=True), - sa.Column('main_activity', sa.String(length=255), nullable=True), - sa.Column('program', sa.String(length=10), nullable=True), - sa.Column('program_number', sa.String(length=40), nullable=True), - sa.Column('prosec', sa.SmallInteger(), nullable=True), - sa.Column('prosec_authorization', sa.String(length=20), nullable=True), - sa.Column('manufacturer_id', sa.String(length=25), nullable=True), - sa.Column('broker_company', sa.String(length=10), nullable=True), - sa.Column('responsible', sa.String(length=80), nullable=True), - sa.Column('responsible_name', sa.String(length=20), nullable=True), - sa.Column('responsible_last_name', sa.String(length=20), nullable=True), - sa.Column('responsible_mother_last_name', sa.String(length=20), nullable=True), - sa.Column('responsible_rfc', sa.String(length=30), nullable=True), - sa.Column('position', sa.String(length=30), nullable=True), - sa.Column('logo', sa.String(length=255), nullable=True), - sa.Column('has_express_line', sa.Boolean(), nullable=True), - sa.Column('order_format_type', sa.String(length=19), nullable=True), - sa.Column('previous_code', sa.SmallInteger(), nullable=True), - sa.Column('is_service_company', sa.Boolean(), nullable=True), - sa.Column('client_name', sa.String(length=300), nullable=True), - sa.Column('subassembly_mode', sa.String(length=7), nullable=True), - sa.Column('curp', sa.String(length=19), nullable=True), - sa.Column('inter_db_name', sa.String(length=100), nullable=True), - sa.Column('ctpat_svi', sa.String(length=100), nullable=True), - sa.Column('trusted_exporter_number', sa.String(length=50), nullable=True), - sa.Column('prevalidator_key', sa.String(length=20), nullable=True), - sa.Column('seventh_amendment', sa.Boolean(), nullable=True), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='company_pkey'), - schema='a76' - ) - op.create_index(op.f('ix_a76_company_tenant_id'), 'company', ['tenant_id'], unique=False, schema='a76') - op.create_table('customs_broker_concepts', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('broker_key', sa.String(length=5), nullable=False), - sa.Column('concept', sa.String(length=15), nullable=False), - sa.Column('amount', sa.Numeric(precision=11, scale=2), nullable=True), - sa.Column('priority', sa.Integer(), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('broker_key', 'concept', 'company_id', name='uq_broker_concept'), - schema='a76' - ) - op.create_index(op.f('ix_a76_customs_broker_concepts_tenant_id'), 'customs_broker_concepts', ['tenant_id'], unique=False, schema='a76') - op.create_table('license_usage', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('period_start', sa.DateTime(timezone=True), nullable=False), - sa.Column('period_end', sa.DateTime(timezone=True), nullable=False), - sa.Column('active_users', sa.Integer(), nullable=True), - sa.Column('storage_used_gb', sa.Integer(), nullable=True), - sa.Column('operations_count', sa.Integer(), nullable=True), - sa.Column('api_calls_count', sa.Integer(), nullable=True), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id'), - schema='core' - ) - op.create_index(op.f('ix_core_license_usage_id'), 'license_usage', ['id'], unique=False, schema='core') - op.create_index(op.f('ix_core_license_usage_tenant_id'), 'license_usage', ['tenant_id'], unique=False, schema='core') - op.create_table('licenses', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('plan', sa.Enum('FREE', 'BASIC', 'PROFESSIONAL', 'ENTERPRISE', name='licenseplan'), nullable=False), - sa.Column('status', sa.Enum('ACTIVE', 'EXPIRED', 'SUSPENDED', 'PENDING', 'CANCELLED', name='licensestatus'), nullable=False), - sa.Column('max_users', sa.Integer(), nullable=False), - sa.Column('max_storage_gb', sa.Integer(), nullable=False), - sa.Column('max_monthly_operations', sa.Integer(), nullable=False), - sa.Column('feature_api_access', sa.Boolean(), nullable=True), - sa.Column('feature_advanced_reports', sa.Boolean(), nullable=True), - sa.Column('feature_integrations', sa.Boolean(), nullable=True), - sa.Column('feature_dedicated_support', sa.Boolean(), nullable=True), - sa.Column('starts_at', sa.DateTime(timezone=True), nullable=False), - sa.Column('expires_at', sa.DateTime(timezone=True), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id'), - schema='core' - ) - op.create_index(op.f('ix_core_licenses_id'), 'licenses', ['id'], unique=False, schema='core') - op.create_index(op.f('ix_core_licenses_tenant_id'), 'licenses', ['tenant_id'], unique=True, schema='core') - op.create_table('location', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('code', sa.String(length=5), nullable=False), - sa.Column('description', sa.String(length=200), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='location_pkey'), - sa.UniqueConstraint('code'), - sa.UniqueConstraint('code', name='location_code_unique'), - schema='a24' - ) - op.create_index(op.f('ix_a24_location_company_id'), 'location', ['company_id'], unique=False, schema='a24') - op.create_index(op.f('ix_a24_location_tenant_id'), 'location', ['tenant_id'], unique=False, schema='a24') - op.create_table('classification_concepts', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('classification', sa.String(length=30), nullable=False), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('classification', name='uq_classification_concept'), - schema='a76' - ) - op.create_index(op.f('ix_a76_classification_concepts_company_id'), 'classification_concepts', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_classification_concepts_tenant_id'), 'classification_concepts', ['tenant_id'], unique=False, schema='a76') - op.create_table('clients_and_providers', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('type_nat_foreign', sa.String(length=1), nullable=True), - sa.Column('name', sa.String(length=256), nullable=True), - sa.Column('short_name', sa.String(length=10), nullable=True), - sa.Column('rfc', sa.String(length=30), nullable=True), - sa.Column('curp', sa.String(length=19), nullable=True), - sa.Column('client_or_provider', sa.Enum('CLIENT', 'PROVIDER', 'BOTH', name='entity_client_or_provider'), nullable=False), - sa.Column('linking', sa.String(length=1), nullable=True), - sa.Column('transform_subassembly', sa.String(length=1), nullable=True), - sa.Column('extra_information', sa.String(length=399), nullable=True), - sa.Column('web_key', sa.String(length=40), nullable=True), - sa.Column('responsible', sa.String(length=80), nullable=True), - sa.Column('position', sa.String(length=30), nullable=True), - sa.Column('incoterm', sa.String(length=19), nullable=True), - sa.Column('is_national_provider', sa.Boolean(), nullable=True), - sa.Column('is_active', sa.Boolean(), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='clients_and_providers_pkey'), - schema='a76' - ) - op.create_index(op.f('ix_a76_clients_and_providers_company_id'), 'clients_and_providers', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_clients_and_providers_tenant_id'), 'clients_and_providers', ['tenant_id'], unique=False, schema='a76') - op.create_table('customs_brokers', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('type', sa.String(length=9), nullable=True), - sa.Column('broker_key', sa.String(length=5), nullable=False), - sa.Column('name', sa.String(length=80), nullable=True), - sa.Column('address', sa.String(length=1500), nullable=True), - sa.Column('postal_code', sa.String(length=15), nullable=True), - sa.Column('city', sa.String(length=30), nullable=True), - sa.Column('state', sa.String(length=30), nullable=True), - sa.Column('phone', sa.String(length=30), nullable=True), - sa.Column('fax', sa.String(length=30), nullable=True), - sa.Column('email', sa.String(length=100), nullable=True), - sa.Column('country', sa.String(length=3), nullable=True), - sa.Column('tax_id', sa.String(length=30), nullable=True), - sa.Column('personal_id', sa.String(length=20), nullable=True), - sa.Column('position', sa.String(length=30), nullable=True), - sa.Column('license', sa.String(length=4), nullable=True), - sa.Column('company', sa.String(length=200), nullable=True), - sa.Column('contact', sa.String(length=80), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='customs_brokers_pkey'), - sa.UniqueConstraint('broker_key', 'tenant_id', 'company_id', name='uq_broker_key_tenant_company'), - schema='a76' - ) - op.create_index(op.f('ix_a76_customs_brokers_company_id'), 'customs_brokers', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_customs_brokers_tenant_id'), 'customs_brokers', ['tenant_id'], unique=False, schema='a76') - op.create_table('doda', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('integration_number', sa.String(length=30), nullable=True), - sa.Column('doda_date', sa.Integer(), nullable=True), - sa.Column('doda_time', sa.Integer(), nullable=True), - sa.Column('dispatch_customs', sa.String(length=3), nullable=True), - sa.Column('customs_sections', sa.String(length=3), nullable=True), - sa.Column('patent', sa.String(length=4), nullable=True), - sa.Column('pedimentos', sa.String(length=80), nullable=True), - sa.Column('caat', sa.String(length=10), nullable=True), - sa.Column('transport_identification', sa.String(length=20), nullable=True), - sa.Column('fast_id', sa.String(length=20), nullable=True), - sa.Column('operation_type', sa.String(length=1), nullable=True), - sa.Column('selected', sa.Boolean(), nullable=True), - sa.Column('user_selected', sa.String(length=30), nullable=True), - sa.Column('last_user', sa.String(length=30), nullable=True), - sa.Column('responsible', sa.String(length=14), nullable=True), - sa.Column('carrier', sa.String(length=8), nullable=True), - sa.Column('shipments', sa.String(length=80), nullable=True), - sa.Column('pedimento_type', sa.String(length=30), nullable=True), - sa.Column('original_chain', sa.String(length=5000), nullable=True), - sa.Column('serial_number', sa.String(length=21), nullable=True), - sa.Column('electronic_signature', sa.String(length=2000), nullable=True), - sa.Column('transaction_number', sa.String(length=30), nullable=True), - sa.Column('status', sa.String(length=30), nullable=True), - sa.Column('linq_sat_qr', sa.String(length=1000), nullable=True), - sa.Column('sat_certificate', sa.String(length=2001), nullable=True), - sa.Column('sat_digital_seal', sa.Text(), nullable=True), - sa.Column('xml_doda_sent_path', sa.String(length=1000), nullable=True), - sa.Column('xml_doda_response_path', sa.String(length=1000), nullable=True), - sa.Column('sat_original_chain', sa.Text(), nullable=True), - sa.Column('customs_clearance', sa.Integer(), nullable=True), - sa.Column('unique_badge_number', sa.String(length=250), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='doda_pkey'), - schema='a76' - ) - op.create_index(op.f('ix_a76_doda_company_id'), 'doda', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_doda_tenant_id'), 'doda', ['tenant_id'], unique=False, schema='a76') - op.create_table('electronic_notices', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('notice_number', sa.String(length=500), nullable=True), - sa.Column('year', sa.String(length=20), nullable=True), - sa.Column('patent', sa.String(length=4), nullable=True), - sa.Column('pedimento', sa.String(length=15), nullable=True), - sa.Column('file_sent', sa.String(length=1000), nullable=True), - sa.Column('file_response', sa.String(length=1000), nullable=True), - sa.Column('status', sa.String(length=100), nullable=True), - sa.Column('invoice', sa.String(length=50), nullable=True), - sa.Column('validation_acknowledgment', sa.String(length=20), nullable=True), - sa.Column('fea', sa.String(length=1000), nullable=True), - sa.Column('certificate_number', sa.String(length=50), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='electronic_notices_pkey'), - schema='a76' - ) - op.create_index(op.f('ix_a76_electronic_notices_company_id'), 'electronic_notices', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_electronic_notices_tenant_id'), 'electronic_notices', ['tenant_id'], unique=False, schema='a76') - op.create_table('equivalencies', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('identifier', sa.String(length=10), nullable=False), - sa.Column('description', sa.String(length=200), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('identifier', 'tenant_id', 'company_id', name='uq_equivalency_identifier'), - schema='a76' - ) - op.create_index(op.f('ix_a76_equivalencies_company_id'), 'equivalencies', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_equivalencies_tenant_id'), 'equivalencies', ['tenant_id'], unique=False, schema='a76') - op.create_table('error_classifications', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('code', sa.String(length=100), nullable=False), - sa.Column('level', sa.String(length=3), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='error_classifications_pkey'), - sa.UniqueConstraint('code'), - sa.UniqueConstraint('code', name='error_classifications_code_unique'), - schema='a76' - ) - op.create_index(op.f('ix_a76_error_classifications_company_id'), 'error_classifications', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_error_classifications_tenant_id'), 'error_classifications', ['tenant_id'], unique=False, schema='a76') - op.create_table('exchange_rate', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('date', sa.DateTime(), nullable=False), - sa.Column('value', sa.DECIMAL(precision=13, scale=6), nullable=True), - sa.Column('local_currency', sa.String(length=7), nullable=True), - sa.Column('foreign_currency', sa.String(length=7), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='exchange_rate_pkey'), - sa.UniqueConstraint('tenant_id', 'company_id', 'date', name='uq_exchange_rate_date_tenant'), - schema='a76' - ) - op.create_index(op.f('ix_a76_exchange_rate_company_id'), 'exchange_rate', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_exchange_rate_tenant_id'), 'exchange_rate', ['tenant_id'], unique=False, schema='a76') - op.create_table('fraction_rule_octave', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('permission', sa.String(length=20), nullable=False), - sa.Column('line', sa.Integer(), nullable=False), - sa.Column('fraction', sa.String(length=10), nullable=False), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='fraction_rule_octave_pkey'), - sa.UniqueConstraint('tenant_id', 'company_id', 'permission', 'line', 'fraction', name='uq_fraction_rule_octave_permission_line_fraction'), - schema='a76' - ) - op.create_index(op.f('ix_a76_fraction_rule_octave_company_id'), 'fraction_rule_octave', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_fraction_rule_octave_tenant_id'), 'fraction_rule_octave', ['tenant_id'], unique=False, schema='a76') - op.create_table('identifiers', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('code', sa.String(length=2), nullable=False), - sa.Column('description', sa.String(length=1000), nullable=True), - sa.Column('level', sa.String(length=1), nullable=True), - sa.Column('complement', sa.String(length=5000), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('code', name='uq_identifier_code'), - schema='a76' - ) - op.create_index(op.f('ix_a76_identifiers_company_id'), 'identifiers', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_identifiers_tenant_id'), 'identifiers', ['tenant_id'], unique=False, schema='a76') - op.create_table('inpc', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('year', sa.String(length=4), nullable=False), - sa.Column('month', sa.String(length=2), nullable=False), - sa.Column('value', sa.Numeric(precision=19, scale=8), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('year', 'month', 'tenant_id', 'company_id', name='uq_inpc_year_month'), - schema='a76' - ) - op.create_index(op.f('ix_a76_inpc_company_id'), 'inpc', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_inpc_tenant_id'), 'inpc', ['tenant_id'], unique=False, schema='a76') - op.create_table('invoice_header', - sa.Column('id', sa.BigInteger(), autoincrement=True, nullable=False), - sa.Column('system', sa.String(length=12), nullable=True), - sa.Column('operation_type', sa.String(length=10), nullable=False), - sa.Column('invoice_type', sa.String(length=5), nullable=True), - sa.Column('invoice_number', sa.String(length=20), nullable=True), - sa.Column('project_number', sa.String(length=14), nullable=True), - sa.Column('purchase_order', sa.String(length=50), nullable=True), - sa.Column('related_doc_id', sa.Integer(), nullable=True), - sa.Column('alternate_invoice', sa.String(length=99), nullable=True), - sa.Column('invoice_ref', sa.String(length=19), nullable=True), - sa.Column('proforma_number', sa.String(length=20), nullable=True), - sa.Column('invoice_date', sa.Date(), nullable=True), - sa.Column('capture_date', sa.TIMESTAMP(), nullable=False), - sa.Column('emission_date', sa.Date(), nullable=True), - sa.Column('is_updated', sa.Boolean(), nullable=True), - sa.Column('updated_date', sa.TIMESTAMP(), nullable=True), - sa.Column('who_updated', sa.String(length=20), nullable=True), - sa.Column('capture_user', sa.String(length=20), nullable=True), - sa.Column('traffic_light_status', sa.String(length=50), nullable=True), - sa.Column('process_log', sa.String(length=300), nullable=True), - sa.Column('status_rec', sa.Integer(), nullable=True), - sa.Column('status_rep', sa.String(length=2), nullable=True), - sa.Column('observation_es', sa.Text(), nullable=True), - sa.Column('observation_en', sa.Text(), nullable=True), - sa.Column('comments_status', sa.Text(), nullable=True), - sa.Column('vu_observations', sa.String(length=500), nullable=True), - sa.Column('cfdi_uuid', sa.String(length=100), nullable=True), - sa.Column('path_pdf', sa.String(length=500), nullable=True), - sa.Column('path_xml', sa.String(length=500), nullable=True), - sa.Column('subcompany', sa.String(length=5), nullable=True), - sa.Column('party_count', sa.Integer(), nullable=True), - sa.Column('generate_id', sa.String(length=1), nullable=True), - sa.Column('generate_desc_parties', sa.String(length=12), nullable=True), - sa.Column('apply_manual_discount', sa.String(length=1), nullable=True), - sa.Column('is_bulk', sa.Boolean(), nullable=True), - sa.Column('download_substance', sa.Boolean(), nullable=True), - sa.Column('download_class', sa.Boolean(), nullable=True), - sa.Column('download_def', sa.Boolean(), nullable=True), - sa.Column('payment_terms', sa.String(length=200), nullable=True), - sa.Column('handling_fees', sa.Numeric(precision=19, scale=8), nullable=True), - sa.Column('option_iv18', sa.String(length=50), nullable=True), - sa.Column('enajenation_goods', sa.Boolean(), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['invoice_type'], ['public.invoice_types.key'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id'), - schema='a76' - ) - op.create_index(op.f('ix_a76_invoice_header_company_id'), 'invoice_header', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_invoice_header_tenant_id'), 'invoice_header', ['tenant_id'], unique=False, schema='a76') - op.create_table('legends', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('code', sa.Integer(), nullable=False), - sa.Column('description', sa.String(length=2000), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('code', 'tenant_id', 'company_id', name='uq_legend_code'), - schema='a76' - ) - op.create_index(op.f('ix_a76_legends_company_id'), 'legends', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_legends_tenant_id'), 'legends', ['tenant_id'], unique=False, schema='a76') - op.create_table('multi_currency_types', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('currency_type_code', sa.String(length=3), nullable=False), - sa.Column('country_key', sa.String(length=3), nullable=True), - sa.Column('conversion_factor', sa.Numeric(precision=13, scale=6), nullable=True), - sa.Column('publication_date', sa.Integer(), nullable=False), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['country_key'], ['public.countries.m3_key'], ), - sa.ForeignKeyConstraint(['currency_type_code'], ['public.currency_types.code'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('currency_type_code', 'publication_date', 'tenant_id', 'company_id', name='uq_multi_currency_type_code_date'), - schema='a76' - ) - op.create_index(op.f('ix_a76_multi_currency_types_company_id'), 'multi_currency_types', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_multi_currency_types_tenant_id'), 'multi_currency_types', ['tenant_id'], unique=False, schema='a76') - op.create_table('packages', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('key', sa.String(length=5), nullable=False), - sa.Column('description_es', sa.String(length=40), nullable=True), - sa.Column('description_en', sa.String(length=40), nullable=True), - sa.Column('weight_unit', sa.DECIMAL(precision=19, scale=8), nullable=True), - sa.Column('plurals', sa.String(length=4), nullable=True), - sa.Column('plural_in', sa.String(length=4), nullable=True), - sa.Column('code_ace', sa.String(length=4), nullable=True), - sa.Column('code_aamex', sa.String(length=9), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='packages_pkey'), - sa.UniqueConstraint('tenant_id', 'company_id', 'key', name='packages_key_ukey'), - schema='a76' - ) - op.create_index(op.f('ix_a76_packages_company_id'), 'packages', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_packages_tenant_id'), 'packages', ['tenant_id'], unique=False, schema='a76') - op.create_table('packing_lists', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('item_line_id', sa.Integer(), nullable=False), - sa.Column('packing_list_number', sa.String(length=100), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id'), - schema='a76' - ) - op.create_index(op.f('ix_a76_packing_lists_company_id'), 'packing_lists', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_packing_lists_tenant_id'), 'packing_lists', ['tenant_id'], unique=False, schema='a76') - op.create_table('permission_rule_oct', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('permission', sa.String(length=20), nullable=False), - sa.Column('start_date', sa.Integer(), nullable=True), - sa.Column('end_date', sa.Integer(), nullable=True), - sa.Column('sector', sa.String(length=8), nullable=True), - sa.Column('system', sa.String(length=5), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='permission_rule_oct_pkey'), - sa.UniqueConstraint('tenant_id', 'company_id', 'permission', name='permission_rule_oct_permission_tenant_ukey'), - schema='a76' - ) - op.create_index(op.f('ix_a76_permission_rule_oct_company_id'), 'permission_rule_oct', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_permission_rule_oct_tenant_id'), 'permission_rule_oct', ['tenant_id'], unique=False, schema='a76') - op.create_table('ports', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('port_code', sa.String(length=6), nullable=False), - sa.Column('description', sa.String(length=20), nullable=True), - sa.Column('location_code', sa.String(length=4), nullable=False), - sa.Column('location_description', sa.String(length=20), nullable=True), - sa.Column('port_type', sa.String(length=15), nullable=False), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('port_code', 'location_code', 'tenant_id', 'company_id', name='uq_port_location'), - schema='a76' - ) - op.create_index(op.f('ix_a76_ports_company_id'), 'ports', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_ports_tenant_id'), 'ports', ['tenant_id'], unique=False, schema='a76') - op.create_table('prevalidators', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('code', sa.String(length=20), nullable=False), - sa.Column('customs_prevalidator', sa.String(length=20), nullable=True), - sa.Column('patent_prevalidator', sa.String(length=20), nullable=True), - sa.Column('description', sa.String(length=50), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='prevalidators_pkey'), - sa.UniqueConstraint('code', 'tenant_id', 'company_id', name='prevalidators_code_unique'), - schema='a76' - ) - op.create_index(op.f('ix_a76_prevalidators_company_id'), 'prevalidators', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_prevalidators_tenant_id'), 'prevalidators', ['tenant_id'], unique=False, schema='a76') - op.create_table('seal', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('seal', sa.String(length=15), nullable=False), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='seal_pkey'), - sa.UniqueConstraint('tenant_id', 'company_id', 'seal', name='seal_ukey'), - schema='a76' - ) - op.create_index(op.f('ix_a76_seal_company_id'), 'seal', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_seal_tenant_id'), 'seal', ['tenant_id'], unique=False, schema='a76') - op.create_table('signatures', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('code', sa.String(length=10), nullable=False), - sa.Column('signature', sa.String(length=1000), nullable=True), - sa.Column('photo_path', sa.String(length=1000), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='signatures_pkey'), - sa.UniqueConstraint('code', 'tenant_id', 'company_id', name='signatures_code_unique'), - schema='a76' - ) - op.create_index(op.f('ix_a76_signatures_company_id'), 'signatures', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_signatures_tenant_id'), 'signatures', ['tenant_id'], unique=False, schema='a76') - op.create_table('subassembly_entries', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('remission_line', sa.Integer(), nullable=False), - sa.Column('exit_invoice', sa.String(length=15), nullable=True), - sa.Column('exit_line', sa.Integer(), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id'), - schema='a76' - ) - op.create_index(op.f('ix_a76_subassembly_entries_company_id'), 'subassembly_entries', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_subassembly_entries_tenant_id'), 'subassembly_entries', ['tenant_id'], unique=False, schema='a76') - op.create_table('trailer_type', - sa.Column('trailer_type_key', sa.String(length=2), nullable=False), - sa.Column('description', sa.String(length=100), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('trailer_type_key'), - schema='a76' - ) - op.create_index(op.f('ix_a76_trailer_type_company_id'), 'trailer_type', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_trailer_type_tenant_id'), 'trailer_type', ['tenant_id'], unique=False, schema='a76') - op.create_table('transporter', - sa.Column('transporter_key', sa.String(length=5), nullable=False), - sa.Column('name', sa.String(length=256), nullable=True), - sa.Column('short_name', sa.String(length=10), nullable=True), - sa.Column('responsible', sa.String(length=100), nullable=True), - sa.Column('rfc', sa.String(length=30), nullable=True), - sa.Column('streets', sa.String(length=100), nullable=True), - sa.Column('postal_code', sa.String(length=15), nullable=True), - sa.Column('city', sa.String(length=30), nullable=True), - sa.Column('state', sa.String(length=30), nullable=True), - sa.Column('country', sa.String(length=3), nullable=True), - sa.Column('loader_code', sa.String(length=9), nullable=True), - sa.Column('caat_code', sa.String(length=49), nullable=True), - sa.Column('transport_code', sa.String(length=8), nullable=True), - sa.Column('transport_interface_type', sa.String(length=20), nullable=True), - sa.Column('ftp_server', sa.String(length=200), nullable=True), - sa.Column('ftp_user', sa.String(length=200), nullable=True), - sa.Column('ftp_password', sa.String(length=100), nullable=True), - sa.Column('ftp_directory', sa.String(length=1000), nullable=True), - sa.Column('filler_code', sa.String(length=4), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('transporter_key'), - schema='a76' - ) - op.create_index(op.f('ix_a76_transporter_company_id'), 'transporter', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_transporter_tenant_id'), 'transporter', ['tenant_id'], unique=False, schema='a76') - op.create_table('unit_of_measure_ace', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('code', sa.String(length=4), nullable=False), - sa.Column('description', sa.String(length=49), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('code', 'tenant_id', 'company_id', name='uq_uom_ace_code'), - sa.UniqueConstraint('code', 'tenant_id', 'company_id', name='uq_uom_ace_code'), - schema='a76' - ) - op.create_index(op.f('ix_a76_unit_of_measure_ace_company_id'), 'unit_of_measure_ace', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_unit_of_measure_ace_tenant_id'), 'unit_of_measure_ace', ['tenant_id'], unique=False, schema='a76') - op.create_table('unit_of_measure_american', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('code', sa.String(length=3), nullable=False), - sa.Column('description', sa.String(length=40), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('code', 'tenant_id', 'company_id', name='uq_uom_american_code'), - sa.UniqueConstraint('code', 'tenant_id', 'company_id', name='uq_uom_american_code'), - schema='a76' - ) - op.create_index(op.f('ix_a76_unit_of_measure_american_company_id'), 'unit_of_measure_american', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_unit_of_measure_american_tenant_id'), 'unit_of_measure_american', ['tenant_id'], unique=False, schema='a76') - op.create_table('unit_of_measure_customs', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('code', sa.String(length=2), nullable=False), - sa.Column('description', sa.String(length=20), nullable=True), - sa.Column('scaii_unit_code', sa.String(length=5), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('code', 'tenant_id', 'company_id', name='uq_uom_customs_code'), - sa.UniqueConstraint('code', 'tenant_id', 'company_id', name='uq_uom_customs_code'), - schema='a76' - ) - op.create_index(op.f('ix_a76_unit_of_measure_customs_company_id'), 'unit_of_measure_customs', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_unit_of_measure_customs_tenant_id'), 'unit_of_measure_customs', ['tenant_id'], unique=False, schema='a76') - op.create_table('unit_of_measure_oma', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('code', sa.String(length=10), nullable=False), - sa.Column('description', sa.String(length=200), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('code', 'tenant_id', 'company_id', name='uq_uom_oma_code'), - sa.UniqueConstraint('code', 'tenant_id', 'company_id', name='uq_uom_oma_code'), - schema='a76' - ) - op.create_index(op.f('ix_a76_unit_of_measure_oma_company_id'), 'unit_of_measure_oma', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_unit_of_measure_oma_tenant_id'), 'unit_of_measure_oma', ['tenant_id'], unique=False, schema='a76') - op.create_table('units_of_measure', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('code', sa.String(length=5), nullable=False), - sa.Column('description', sa.String(length=100), nullable=True), - sa.Column('description_en', sa.String(length=100), nullable=True), - sa.Column('customs_code', sa.String(length=2), nullable=True), - sa.Column('american_code', sa.String(length=3), nullable=True), - sa.Column('ace_code', sa.String(length=4), nullable=True), - sa.Column('oma_code', sa.String(length=10), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['ace_code', 'tenant_id', 'company_id'], ['a76.unit_of_measure_ace.code', 'a76.unit_of_measure_ace.tenant_id', 'a76.unit_of_measure_ace.company_id'], name='fk_uom_ace', use_alter=True), - sa.ForeignKeyConstraint(['american_code', 'tenant_id', 'company_id'], ['a76.unit_of_measure_american.code', 'a76.unit_of_measure_american.tenant_id', 'a76.unit_of_measure_american.company_id'], name='fk_uom_american', use_alter=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['customs_code', 'tenant_id', 'company_id'], ['a76.unit_of_measure_customs.code', 'a76.unit_of_measure_customs.tenant_id', 'a76.unit_of_measure_customs.company_id'], name='fk_uom_customs', use_alter=True), - sa.ForeignKeyConstraint(['oma_code', 'tenant_id', 'company_id'], ['a76.unit_of_measure_oma.code', 'a76.unit_of_measure_oma.tenant_id', 'a76.unit_of_measure_oma.company_id'], name='fk_uom_oma', use_alter=True), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('code', 'tenant_id', 'company_id', name='uq_uom_code'), - sa.UniqueConstraint('code', 'tenant_id', 'company_id', name='uq_uom_code'), - schema='a76' - ) - op.create_index(op.f('ix_a76_units_of_measure_company_id'), 'units_of_measure', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_units_of_measure_tenant_id'), 'units_of_measure', ['tenant_id'], unique=False, schema='a76') - op.create_table('units_of_measure_general', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('code', sa.String(length=5), nullable=False), - sa.Column('description', sa.String(length=100), nullable=True), - sa.Column('conversion_factor', sa.Numeric(precision=13, scale=6), nullable=True), - sa.Column('mexico_unit', sa.String(length=5), nullable=True), - sa.Column('american_unit_code', sa.String(length=5), nullable=True), - sa.Column('customs_code', sa.String(length=2), nullable=True), - sa.Column('ace_code', sa.String(length=4), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['ace_code', 'tenant_id', 'company_id'], ['a76.unit_of_measure_ace.code', 'a76.unit_of_measure_ace.tenant_id', 'a76.unit_of_measure_ace.company_id'], name='fk_uom_general_ace', use_alter=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['customs_code', 'tenant_id', 'company_id'], ['a76.unit_of_measure_customs.code', 'a76.unit_of_measure_customs.tenant_id', 'a76.unit_of_measure_customs.company_id'], name='fk_uom_general_customs', use_alter=True), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('code', 'tenant_id', 'company_id', name='uq_uom_general_code'), - sa.UniqueConstraint('code', 'tenant_id', 'company_id', name='uq_uom_general_code'), - schema='a76' - ) - op.create_index(op.f('ix_a76_units_of_measure_general_company_id'), 'units_of_measure_general', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_units_of_measure_general_tenant_id'), 'units_of_measure_general', ['tenant_id'], unique=False, schema='a76') - op.create_table('vehicle', - sa.Column('vehicle_key', sa.String(length=14), nullable=False), - sa.Column('ace_vehicle_key', sa.String(length=10), nullable=True), - sa.Column('transporter_key', sa.String(length=23), nullable=True), - sa.Column('transport_identifier', sa.String(length=30), nullable=True), - sa.Column('transport_type', sa.String(length=2), nullable=True), - sa.Column('entity_code', sa.String(length=1), nullable=True), - sa.Column('transponder_number', sa.String(length=16), nullable=True), - sa.Column('dot_number', sa.String(length=8), nullable=True), - sa.Column('plate_number', sa.String(length=17), nullable=True), - sa.Column('city', sa.String(length=30), nullable=True), - sa.Column('state', sa.String(length=30), nullable=True), - sa.Column('country', sa.String(length=3), nullable=True), - sa.Column('seal', sa.String(length=49), nullable=True), - sa.Column('insurance_company_name', sa.String(length=30), nullable=True), - sa.Column('insurance_number', sa.String(length=20), nullable=True), - sa.Column('insurance_amount', sa.DECIMAL(precision=13, scale=2), nullable=True), - sa.Column('insurance_date', sa.Integer(), nullable=True), - sa.Column('box_number', sa.String(length=300), nullable=True), - sa.Column('brand', sa.String(length=20), nullable=True), - sa.Column('year', sa.String(length=4), nullable=True), - sa.Column('series', sa.String(length=30), nullable=True), - sa.Column('description', sa.String(length=100), nullable=True), - sa.Column('engine_number', sa.String(length=50), nullable=True), - sa.Column('sct_permission', sa.String(length=40), nullable=True), - sa.Column('color', sa.String(length=20), nullable=True), - sa.Column('container_key', sa.String(length=3), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('vehicle_key'), - schema='a76' - ) - op.create_index(op.f('ix_a76_vehicle_company_id'), 'vehicle', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_vehicle_tenant_id'), 'vehicle', ['tenant_id'], unique=False, schema='a76') - op.create_table('user_tenants', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('keycloak_user_id', sa.String(length=255), nullable=False), - sa.Column('is_active', sa.Boolean(), nullable=False), - sa.Column('role', sa.String(length=50), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('keycloak_user_id', 'tenant_id', 'company_id', name='uq_user_tenant'), - schema='core' - ) - op.create_index(op.f('ix_core_user_tenants_company_id'), 'user_tenants', ['company_id'], unique=False, schema='core') - op.create_index(op.f('ix_core_user_tenants_id'), 'user_tenants', ['id'], unique=False, schema='core') - op.create_index(op.f('ix_core_user_tenants_keycloak_user_id'), 'user_tenants', ['keycloak_user_id'], unique=False, schema='core') - op.create_index(op.f('ix_core_user_tenants_tenant_id'), 'user_tenants', ['tenant_id'], unique=False, schema='core') - op.create_table('classes', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('client_id', sa.Integer(), nullable=False), - sa.Column('class_code', sa.String(length=8), nullable=False), - sa.Column('description_es', sa.String(length=500), nullable=True), - sa.Column('description_en', sa.String(length=500), nullable=True), - sa.Column('material_key', sa.String(length=10), nullable=True), - sa.Column('unit_of_measure', sa.String(length=5), nullable=True), - sa.Column('fraction', sa.String(length=10), nullable=True), - sa.Column('us_fraction', sa.String(length=16), nullable=True), - sa.Column('sub_key', sa.String(length=5), nullable=True), - sa.Column('physical_review', sa.SmallInteger(), nullable=True), - sa.Column('iva_exempt_fraction', sa.String(length=4), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['client_id'], ['a76.clients_and_providers.id'], name='fk_classes_client'), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['material_key'], ['public.material_types.key'], name='fk_classes_material_type'), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.ForeignKeyConstraint(['unit_of_measure', 'tenant_id', 'company_id'], ['a76.units_of_measure.code', 'a76.units_of_measure.tenant_id', 'a76.units_of_measure.company_id'], ), - sa.PrimaryKeyConstraint('id', name='classes_pkey'), - sa.UniqueConstraint('tenant_id', 'company_id', 'client_id', 'class_code', name='ufa_classes_client_id_class_code'), - schema='a76' - ) - op.create_index(op.f('ix_a76_classes_company_id'), 'classes', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_classes_tenant_id'), 'classes', ['tenant_id'], unique=False, schema='a76') - op.create_table('clients_and_providers_address', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('client_id', sa.Integer(), nullable=False), - sa.Column('municipality', sa.String(length=150), nullable=True), - sa.Column('streets', sa.String(length=100), nullable=True), - sa.Column('neighborhood', sa.String(length=40), nullable=True), - sa.Column('interior_number', sa.String(length=20), nullable=True), - sa.Column('exterior_number', sa.String(length=20), nullable=True), - sa.Column('postal_code', sa.String(length=15), nullable=True), - sa.Column('city', sa.String(length=30), nullable=True), - sa.Column('state', sa.String(length=30), nullable=True), - sa.Column('country', sa.String(length=3), nullable=True), - sa.Column('phone', sa.String(length=30), nullable=True), - sa.Column('fax_number', sa.String(length=30), nullable=True), - sa.Column('email', sa.String(length=100), nullable=True), - sa.Column('contact', sa.String(length=50), nullable=True), - sa.Column('reference', sa.String(length=250), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['client_id'], ['a76.clients_and_providers.id'], name='fk_clients_and_providers_address_client', ondelete='CASCADE'), - sa.ForeignKeyConstraint(['client_id'], ['a76.clients_and_providers.id'], ondelete='CASCADE'), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='clients_and_providers_address_pkey'), - schema='a76' - ) - op.create_index(op.f('ix_a76_clients_and_providers_address_company_id'), 'clients_and_providers_address', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_clients_and_providers_address_tenant_id'), 'clients_and_providers_address', ['tenant_id'], unique=False, schema='a76') - op.create_table('clients_and_providers_programs', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('client_id', sa.Integer(), nullable=False), - sa.Column('program', sa.String(length=7), nullable=True), - sa.Column('program_number', sa.String(length=40), nullable=True), - sa.Column('prosec', sa.SmallInteger(), nullable=True), - sa.Column('prosec_authorization', sa.String(length=20), nullable=True), - sa.Column('secon_auth_date', sa.Integer(), nullable=True), - sa.Column('manufacturer_id', sa.String(length=25), nullable=True), - sa.Column('tax_id', sa.String(length=30), nullable=True), - sa.Column('broker', sa.String(length=6), nullable=True), - sa.Column('import_broker', sa.String(length=6), nullable=True), - sa.Column('transfer_key', sa.String(length=8), nullable=True), - sa.Column('secon_authorization', sa.String(length=20), nullable=True), - sa.Column('applied_proportion', sa.Numeric(precision=7, scale=2), nullable=True), - sa.Column('is_certified_company', sa.String(length=1), nullable=True), - sa.Column('certified_company_registry', sa.String(length=40), nullable=True), - sa.Column('donation_auth_number', sa.String(length=50), nullable=True), - sa.Column('ctpat_svi', sa.String(length=100), nullable=True), - sa.Column('tax_registry_number', sa.String(length=40), nullable=True), - sa.Column('subassembly_service', sa.SmallInteger(), nullable=True), - sa.Column('autse_dates', sa.Integer(), nullable=True), - sa.Column('autse_number', sa.String(length=300), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['client_id'], ['a76.clients_and_providers.id'], name='fk_clients_and_providers_programs_client', ondelete='CASCADE'), - sa.ForeignKeyConstraint(['client_id'], ['a76.clients_and_providers.id'], ondelete='CASCADE'), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='clients_and_providers_programs_pkey'), - schema='a76' - ) - op.create_index(op.f('ix_a76_clients_and_providers_programs_company_id'), 'clients_and_providers_programs', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_clients_and_providers_programs_tenant_id'), 'clients_and_providers_programs', ['tenant_id'], unique=False, schema='a76') - op.create_table('concepts', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('code', sa.String(length=15), nullable=False), - sa.Column('description', sa.String(length=120), nullable=True), - sa.Column('description_en', sa.String(length=120), nullable=True), - sa.Column('detailed_description', sa.String(length=1000), nullable=True), - sa.Column('priority', sa.Integer(), nullable=True), - sa.Column('priority_ame', sa.Integer(), nullable=True), - sa.Column('first_total', sa.Boolean(), nullable=True), - sa.Column('type', sa.String(length=9), nullable=True), - sa.Column('is_printed', sa.Boolean(), nullable=True), - sa.Column('section', sa.Integer(), nullable=True), - sa.Column('classification', sa.String(length=30), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['classification'], ['a76.classification_concepts.classification'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('code', name='uq_concept_code'), - schema='a76' - ) - op.create_index(op.f('ix_a76_concepts_tenant_id'), 'concepts', ['tenant_id'], unique=False, schema='a76') - op.create_table('country_rule_oct', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('permission', sa.String(length=20), nullable=False), - sa.Column('line', sa.Integer(), nullable=False), - sa.Column('fraction', sa.String(length=10), nullable=False), - sa.Column('country_code', sa.String(length=3), nullable=False), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id', 'company_id', 'permission', 'line', 'fraction'], ['a76.fraction_rule_octave.tenant_id', 'a76.fraction_rule_octave.company_id', 'a76.fraction_rule_octave.permission', 'a76.fraction_rule_octave.line', 'a76.fraction_rule_octave.fraction'], name='fk_country_rule_oct_frac_octava', ondelete='CASCADE'), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='country_rule_oct_pkey'), - sa.UniqueConstraint('tenant_id', 'company_id', 'permission', 'line', 'fraction', 'country_code', name='uq_country_rule_oct_permission_line_fraction_country'), - schema='a76' - ) - op.create_index(op.f('ix_a76_country_rule_oct_company_id'), 'country_rule_oct', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_country_rule_oct_tenant_id'), 'country_rule_oct', ['tenant_id'], unique=False, schema='a76') - op.create_table('customs_brokers_personnel', - sa.Column('customs_broker_id', sa.Integer(), nullable=False), - sa.Column('line', sa.Integer(), nullable=False), - sa.Column('name', sa.String(length=80), nullable=True), - sa.Column('tax_id', sa.String(length=30), nullable=True), - sa.Column('personal_id', sa.String(length=20), nullable=True), - sa.Column('position', sa.String(length=30), nullable=True), - sa.Column('license', sa.String(length=4), nullable=True), - sa.Column('first_name', sa.String(length=80), nullable=True), - sa.Column('last_name', sa.String(length=80), nullable=True), - sa.Column('middle_name', sa.String(length=80), nullable=True), - sa.Column('email', sa.String(length=100), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['customs_broker_id'], ['a76.customs_brokers.id'], ondelete='CASCADE'), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('customs_broker_id', 'line'), - schema='a76' - ) - op.create_index(op.f('ix_a76_customs_brokers_personnel_company_id'), 'customs_brokers_personnel', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_customs_brokers_personnel_tenant_id'), 'customs_brokers_personnel', ['tenant_id'], unique=False, schema='a76') - op.create_table('customs_brokers_vu', - sa.Column('customs_broker_id', sa.Integer(), nullable=False), - sa.Column('certificate_path', sa.String(length=1499), nullable=True), - sa.Column('key_path', sa.String(length=1499), nullable=True), - sa.Column('access_key', sa.String(length=50), nullable=True), - sa.Column('fiel_format', sa.String(length=19), nullable=True), - sa.Column('signature_read_path', sa.String(length=1499), nullable=True), - sa.Column('archive_path', sa.String(length=1499), nullable=True), - sa.Column('fiel_access_key', sa.String(length=50), nullable=True), - sa.Column('web_service_user', sa.String(length=100), nullable=True), - sa.Column('web_service_access_key', sa.String(length=100), nullable=True), - sa.Column('vu_email', sa.String(length=800), nullable=True), - sa.Column('vu_figure_type', sa.String(length=29), nullable=True), - sa.Column('xml_files_path', sa.String(length=1499), nullable=True), - sa.Column('query_tax_id', sa.String(length=30), nullable=True), - sa.Column('doda_certificate_path', sa.String(length=1499), nullable=True), - sa.Column('doda_key_path', sa.String(length=1499), nullable=True), - sa.Column('doda_web_service_user', sa.String(length=100), nullable=True), - sa.Column('doda_web_service_access_key', sa.String(length=100), nullable=True), - sa.Column('doda_fiel_access_key', sa.String(length=50), nullable=True), - sa.Column('doda_xml_files_path', sa.String(length=1499), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['customs_broker_id'], ['a76.customs_brokers.id'], ondelete='CASCADE'), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('customs_broker_id'), - schema='a76' - ) - op.create_index(op.f('ix_a76_customs_brokers_vu_company_id'), 'customs_brokers_vu', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_customs_brokers_vu_tenant_id'), 'customs_brokers_vu', ['tenant_id'], unique=False, schema='a76') - op.create_table('doda_american_pedimentos', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('doda_id', sa.Integer(), nullable=False), - sa.Column('american_pedimento_line', sa.Integer(), nullable=False), - sa.Column('american_pedimento_type', sa.String(length=2), nullable=True), - sa.Column('american_pedimento_value', sa.String(length=20), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['doda_id'], ['a76.doda.id'], name='fk_doda_american_pedimentos_doda'), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='doda_american_pedimentos_pkey'), - schema='a76' - ) - op.create_index(op.f('ix_a76_doda_american_pedimentos_company_id'), 'doda_american_pedimentos', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_doda_american_pedimentos_tenant_id'), 'doda_american_pedimentos', ['tenant_id'], unique=False, schema='a76') - op.create_table('doda_containers', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('doda_id', sa.Integer(), nullable=False), - sa.Column('container_line', sa.Integer(), nullable=False), - sa.Column('container_value', sa.String(length=20), nullable=True), - sa.Column('seals', sa.String(length=254), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['doda_id'], ['a76.doda.id'], name='fk_doda_containers_doda'), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='doda_containers_pkey'), - schema='a76' - ) - op.create_index(op.f('ix_a76_doda_containers_company_id'), 'doda_containers', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_doda_containers_tenant_id'), 'doda_containers', ['tenant_id'], unique=False, schema='a76') - op.create_table('doda_pedimentos', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('doda_id', sa.Integer(), nullable=False), - sa.Column('pedimento_line', sa.Integer(), nullable=False), - sa.Column('authorization_patent', sa.String(length=10), nullable=True), - sa.Column('document', sa.String(length=50), nullable=True), - sa.Column('shipment', sa.String(length=11), nullable=True), - sa.Column('cove', sa.String(length=50), nullable=True), - sa.Column('umc', sa.String(length=20), nullable=True), - sa.Column('effective_amount_usd', sa.Numeric(precision=15, scale=2), nullable=True), - sa.Column('difference_amount_usd', sa.Numeric(precision=15, scale=2), nullable=True), - sa.Column('dta_niu', sa.String(length=20), nullable=True), - sa.Column('article_7', sa.Boolean(), nullable=True), - sa.Column('pedimento_id', sa.Integer(), nullable=True), - sa.Column('invoice_line', sa.Integer(), nullable=True), - sa.Column('part_ii_line', sa.Integer(), nullable=True), - sa.Column('pedimento_type', sa.String(length=20), nullable=True), - sa.Column('zero_packaging_validation', sa.Boolean(), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['doda_id'], ['a76.doda.id'], name='fk_doda_pedimentos_doda'), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='doda_pedimentos_pkey'), - schema='a76' - ) - op.create_index(op.f('ix_a76_doda_pedimentos_company_id'), 'doda_pedimentos', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_doda_pedimentos_tenant_id'), 'doda_pedimentos', ['tenant_id'], unique=False, schema='a76') - op.create_table('driver', - sa.Column('transporter_key', sa.String(length=5), nullable=False), - sa.Column('line', sa.Integer(), nullable=False), - sa.Column('driver_name', sa.String(length=80), nullable=True), - sa.Column('license_number', sa.String(length=29), nullable=True), - sa.Column('express_line_id', sa.String(length=17), nullable=True), - sa.Column('ace_id', sa.String(length=20), nullable=True), - sa.Column('birth_date', sa.Integer(), nullable=True), - sa.Column('gender', sa.String(length=1), nullable=True), - sa.Column('birth_country', sa.String(length=3), nullable=True), - sa.Column('hazardous_material_auth', sa.String(length=2), nullable=True), - sa.Column('hazardous_material_state', sa.String(length=30), nullable=True), - sa.Column('first_name', sa.String(length=20), nullable=True), - sa.Column('last_name', sa.String(length=20), nullable=True), - sa.Column('id_key1', sa.String(length=40), nullable=True), - sa.Column('id_number1', sa.String(length=20), nullable=True), - sa.Column('id_state1', sa.String(length=30), nullable=True), - sa.Column('id_country1', sa.String(length=3), nullable=True), - sa.Column('id_key2', sa.String(length=40), nullable=True), - sa.Column('id_number2', sa.String(length=20), nullable=True), - sa.Column('id_state2', sa.String(length=30), nullable=True), - sa.Column('id_country2', sa.String(length=3), nullable=True), - sa.Column('badge_number', sa.String(length=20), nullable=True), - sa.Column('class_type', sa.String(length=1), nullable=True), - sa.Column('unique_badge_number', sa.String(length=100), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.ForeignKeyConstraint(['transporter_key'], ['a76.transporter.transporter_key'], ondelete='CASCADE'), - sa.PrimaryKeyConstraint('transporter_key', 'line'), - schema='a76' - ) - op.create_index(op.f('ix_a76_driver_company_id'), 'driver', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_driver_tenant_id'), 'driver', ['tenant_id'], unique=False, schema='a76') - op.create_table('equivalency_items', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('equivalency_id', sa.Integer(), nullable=False), - sa.Column('original_field', sa.String(length=100), nullable=False), - sa.Column('external_field', sa.String(length=100), nullable=False), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['equivalency_id'], ['a76.equivalencies.id'], ), - sa.ForeignKeyConstraint(['original_field', 'tenant_id', 'company_id'], ['a76.units_of_measure.code', 'a76.units_of_measure.tenant_id', 'a76.units_of_measure.company_id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('equivalency_id', 'original_field', 'external_field', 'tenant_id', 'company_id', name='uq_equivalency_item_fields'), - schema='a76' - ) - op.create_index(op.f('ix_a76_equivalency_items_company_id'), 'equivalency_items', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_equivalency_items_tenant_id'), 'equivalency_items', ['tenant_id'], unique=False, schema='a76') - op.create_table('error_catalogs', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('code', sa.String(length=15), nullable=False), - sa.Column('description', sa.String(length=255), nullable=True), - sa.Column('classification_id', sa.Integer(), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['classification_id'], ['a76.error_classifications.id'], name='fk_error_catalogs_classification'), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='error_catalogs_pkey'), - sa.UniqueConstraint('code'), - sa.UniqueConstraint('code', name='error_catalogs_code_unique'), - schema='a76' - ) - op.create_index(op.f('ix_a76_error_catalogs_company_id'), 'error_catalogs', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_error_catalogs_tenant_id'), 'error_catalogs', ['tenant_id'], unique=False, schema='a76') - op.create_table('identifier_details', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('invoice_consecutive', sa.Integer(), nullable=True), - sa.Column('part_line', sa.Integer(), nullable=True), - sa.Column('identifier_code', sa.String(length=2), nullable=True), - sa.Column('module', sa.String(length=20), nullable=True), - sa.Column('complement1', sa.String(length=50), nullable=True), - sa.Column('complement2', sa.String(length=51), nullable=True), - sa.Column('complement3', sa.String(length=50), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['identifier_code'], ['a76.identifiers.code'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id'), - schema='a76' - ) - op.create_index(op.f('ix_a76_identifier_details_company_id'), 'identifier_details', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_identifier_details_tenant_id'), 'identifier_details', ['tenant_id'], unique=False, schema='a76') - op.create_table('invoice_collections', - sa.Column('id', sa.BigInteger(), autoincrement=True, nullable=False), - sa.Column('invoice_id', sa.BigInteger(), nullable=False), - sa.Column('line_number', sa.Integer(), nullable=False), - sa.Column('invoice_number', sa.String(length=15), nullable=True), - sa.Column('concept', sa.String(length=100), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['invoice_id'], ['a76.invoice_header.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id'), - schema='a76' - ) - op.create_index(op.f('ix_a76_invoice_collections_company_id'), 'invoice_collections', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_invoice_collections_tenant_id'), 'invoice_collections', ['tenant_id'], unique=False, schema='a76') - op.create_table('invoice_compliance_mx', - sa.Column('invoice_id', sa.BigInteger(), nullable=False), - sa.Column('pedimento', sa.String(length=19), nullable=True), - sa.Column('pedimento_code', sa.String(length=5), nullable=True), - sa.Column('pedimento_k1', sa.String(length=15), nullable=True), - sa.Column('remesa', sa.Integer(), nullable=True), - sa.Column('aduana', sa.String(length=3), nullable=True), - sa.Column('port_of_entry', sa.String(length=6), nullable=True), - sa.Column('destination', sa.String(length=3), nullable=True), - sa.Column('manifest_number', sa.String(length=15), nullable=True), - sa.Column('provider_header', sa.String(length=20), nullable=True), - sa.Column('provider_id', sa.Integer(), nullable=True), - sa.Column('sold_to_header', sa.String(length=20), nullable=True), - sa.Column('sold_to_id', sa.Integer(), nullable=True), - sa.Column('shipped_to_header', sa.String(length=20), nullable=True), - sa.Column('shipped_to_id', sa.Integer(), nullable=True), - sa.Column('shipped_by_header', sa.String(length=20), nullable=True), - sa.Column('shipped_by_id', sa.Integer(), nullable=True), - sa.Column('customs_broker_id', sa.Integer(), nullable=True), - sa.Column('customs_broker_us_id', sa.Integer(), nullable=True), - sa.Column('broker_invoice_num', sa.String(length=20), nullable=True), - sa.Column('broker_invoice_date', sa.Date(), nullable=True), - sa.Column('is_mixed', sa.Boolean(), nullable=True), - sa.Column('waste_type', sa.String(length=1), nullable=True), - sa.Column('scrap_type', sa.String(length=1), nullable=True), - sa.Column('appendix_17', sa.Integer(), nullable=True), - sa.Column('is_regime_change', sa.String(length=1), nullable=True), - sa.Column('which_exchange_rate', sa.String(length=5), nullable=True), - sa.Column('value_method', sa.String(length=2), nullable=True), - sa.Column('act_value', sa.String(length=5), nullable=True), - sa.Column('is_pedimento_pending', sa.Boolean(), nullable=True), - sa.Column('is_owner_of_goods', sa.String(length=2), nullable=True), - sa.Column('generate_balances', sa.String(length=2), nullable=True), - sa.Column('was_reviewed_by_company', sa.Boolean(), nullable=True), - sa.Column('edocument', sa.String(length=50), nullable=True), - sa.Column('electronic_signature', sa.String(length=999), nullable=True), - sa.Column('certificate_number', sa.String(length=99), nullable=True), - sa.Column('niu_number', sa.String(length=19), nullable=True), - sa.Column('bill_of_lading_count', sa.String(length=12), nullable=True), - sa.Column('addendum_vu', sa.String(length=204), nullable=True), - sa.Column('origin_destination_cove', sa.String(length=19), nullable=True), - sa.Column('vucem_operation_num', sa.String(length=19), nullable=True), - sa.Column('customs_person_line', sa.Integer(), nullable=True), - sa.Column('contingency_mode', sa.Boolean(), nullable=True), - sa.Column('enclosure', sa.String(length=4), nullable=True), - sa.Column('guide_type_to_identify', sa.String(length=1), nullable=True), - sa.Column('location', sa.String(length=200), nullable=True), - sa.Column('dot_code', sa.String(length=20), nullable=True), - sa.Column('subdivision', sa.String(length=20), nullable=True), - sa.Column('acts_as', sa.String(length=20), nullable=True), - sa.Column('movement_type', sa.String(length=31), nullable=True), - sa.Column('office_document', sa.String(length=30), nullable=True), - sa.Column('reason_export', sa.String(length=1), nullable=True), - sa.Column('signature_key', sa.String(length=10), nullable=True), - sa.Column('sem_id', sa.Integer(), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['aduana'], ['public.customs_sections.customs_code'], ), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['customs_broker_id'], ['a76.customs_brokers.id'], ), - sa.ForeignKeyConstraint(['customs_broker_us_id'], ['a76.customs_brokers.id'], ), - sa.ForeignKeyConstraint(['invoice_id'], ['a76.invoice_header.id'], ), - sa.ForeignKeyConstraint(['provider_id'], ['a76.clients_and_providers.id'], ), - sa.ForeignKeyConstraint(['shipped_by_id'], ['a76.clients_and_providers.id'], ), - sa.ForeignKeyConstraint(['shipped_to_id'], ['a76.clients_and_providers.id'], ), - sa.ForeignKeyConstraint(['sold_to_id'], ['a76.clients_and_providers.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('invoice_id'), - schema='a76' - ) - op.create_index(op.f('ix_a76_invoice_compliance_mx_company_id'), 'invoice_compliance_mx', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_invoice_compliance_mx_tenant_id'), 'invoice_compliance_mx', ['tenant_id'], unique=False, schema='a76') - op.create_table('invoice_financials', - sa.Column('id', sa.BigInteger(), autoincrement=True, nullable=False), - sa.Column('invoice_id', sa.BigInteger(), nullable=False), - sa.Column('currency', sa.String(length=3), nullable=True), - sa.Column('currency_type', sa.String(length=3), nullable=True), - sa.Column('exchange_rate', sa.Numeric(precision=13, scale=6), nullable=True), - sa.Column('exchange_rate_mm', sa.Numeric(precision=13, scale=6), nullable=True), - sa.Column('value_mn', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('value_me', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('value_mc', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('customs_value_mn', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('customs_value_me', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('raw_material_value_mn', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('raw_material_value_me', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('aggregate_value_mn', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('aggregate_value_me', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('aggregate_value_mc', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('mexican_value_mn', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('mexican_value_me', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('mexican_value_mc', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('national_packaging_mn', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('national_packaging_me', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('national_packaging_mc', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('freight', sa.Numeric(precision=19, scale=8), nullable=True), - sa.Column('insurance', sa.Numeric(precision=19, scale=8), nullable=True), - sa.Column('insurance_value', sa.Numeric(precision=19, scale=8), nullable=True), - sa.Column('packaging', sa.Numeric(precision=19, scale=8), nullable=True), - sa.Column('other_increments', sa.Numeric(precision=19, scale=8), nullable=True), - sa.Column('total_increments_mn', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('total_increments_me', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('iva_mn', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('iva_me', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('iva_mc', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('iva_factor', sa.String(length=10), nullable=True), - sa.Column('tax_value_me', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('seal_value_2500', sa.Boolean(), nullable=True), - sa.Column('total_quantity', sa.Numeric(precision=19, scale=8), nullable=True), - sa.Column('gross_weight', sa.Numeric(precision=19, scale=8), nullable=True), - sa.Column('net_weight', sa.Numeric(precision=19, scale=8), nullable=True), - sa.Column('bundle_count', sa.Integer(), nullable=True), - sa.Column('weight_factor', sa.Numeric(precision=19, scale=8), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['currency_type'], ['public.currency_types.code'], ), - sa.ForeignKeyConstraint(['invoice_id'], ['a76.invoice_header.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id'), - schema='a76' - ) - op.create_index(op.f('ix_a76_invoice_financials_company_id'), 'invoice_financials', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_invoice_financials_tenant_id'), 'invoice_financials', ['tenant_id'], unique=False, schema='a76') - op.create_table('invoice_logistics', - sa.Column('id', sa.BigInteger(), autoincrement=True, nullable=False), - sa.Column('invoice_id', sa.BigInteger(), nullable=False), - sa.Column('carrier_id', sa.String(length=10), nullable=True), - sa.Column('transport_id', sa.String(length=10), nullable=True), - sa.Column('transport_us_id', sa.String(length=10), nullable=True), - sa.Column('transport_type', sa.String(length=15), nullable=False), - sa.Column('transport_num', sa.String(length=20), nullable=True), - sa.Column('transport_mode', sa.String(length=15), nullable=True), - sa.Column('driver_name', sa.String(length=80), nullable=True), - sa.Column('is_rail', sa.String(length=2), nullable=True), - sa.Column('rail_id', sa.String(length=31), nullable=True), - sa.Column('vehicle_num', sa.String(length=20), nullable=True), - sa.Column('license_plate', sa.String(length=20), nullable=True), - sa.Column('license_plate_complete', sa.String(length=40), nullable=True), - sa.Column('trailer_num', sa.String(length=20), nullable=True), - sa.Column('seal_number', sa.String(length=15), nullable=True), - sa.Column('guide_number', sa.String(length=20), nullable=True), - sa.Column('bill_number', sa.String(length=15), nullable=True), - sa.Column('reference_number', sa.String(length=14), nullable=True), - sa.Column('shipment_number', sa.String(length=19), nullable=True), - sa.Column('incoterm', sa.String(length=5), nullable=True), - sa.Column('identifier_1', sa.String(length=2), nullable=True), - sa.Column('complement_1', sa.String(length=30), nullable=True), - sa.Column('identifier_2', sa.String(length=2), nullable=True), - sa.Column('complement_2', sa.String(length=30), nullable=True), - sa.Column('weight_type', sa.String(length=6), nullable=True), - sa.Column('container_types', sa.String(length=500), nullable=True), - sa.Column('vehicle_data', sa.String(length=500), nullable=True), - sa.Column('origin_location', sa.String(length=200), nullable=True), - sa.Column('destination_location', sa.String(length=200), nullable=True), - sa.Column('transport_itinerary', sa.String(length=1000), nullable=True), - sa.Column('destination_goods', sa.String(length=50), nullable=True), - sa.Column('entry_exit_date', sa.Date(), nullable=True), - sa.Column('delivery_date', sa.Date(), nullable=True), - sa.Column('delivered_status', sa.String(length=2), nullable=True), - sa.Column('received_by', sa.String(length=50), nullable=True), - sa.Column('payment_date', sa.Date(), nullable=True), - sa.Column('payment_receipt_num', sa.String(length=20), nullable=True), - sa.Column('is_ctm_process', sa.String(length=2), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['invoice_id'], ['a76.invoice_header.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id'), - schema='a76' - ) - op.create_index(op.f('ix_a76_invoice_logistics_company_id'), 'invoice_logistics', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_invoice_logistics_tenant_id'), 'invoice_logistics', ['tenant_id'], unique=False, schema='a76') - op.create_table('invoice_sales_details', - sa.Column('id', sa.BigInteger(), autoincrement=True, nullable=False), - sa.Column('invoice_id', sa.BigInteger(), nullable=False), - sa.Column('line_number', sa.Integer(), nullable=False), - sa.Column('sales_order', sa.String(length=20), nullable=True), - sa.Column('colors_description', sa.String(length=49), nullable=True), - sa.Column('square_color_code', sa.String(length=1), nullable=True), - sa.Column('line_bundles', sa.Integer(), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['invoice_id'], ['a76.invoice_header.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id'), - schema='a76' - ) - op.create_index(op.f('ix_a76_invoice_sales_details_company_id'), 'invoice_sales_details', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_invoice_sales_details_tenant_id'), 'invoice_sales_details', ['tenant_id'], unique=False, schema='a76') - op.create_table('items', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('invoice_id', sa.BigInteger(), nullable=False), - sa.Column('reference_number', sa.String(length=20), nullable=True), - sa.Column('order', sa.String(length=50), nullable=True), - sa.Column('guide_number', sa.String(length=50), nullable=True), - sa.Column('depreciation_date', sa.Integer(), nullable=True), - sa.Column('rectification', sa.Boolean(), nullable=True), - sa.Column('warehouse', sa.String(length=30), nullable=True), - sa.Column('location', sa.String(length=200), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['invoice_id'], ['a76.invoice_header.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id'), - schema='a76' - ) - op.create_index(op.f('ix_a76_items_company_id'), 'items', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_items_tenant_id'), 'items', ['tenant_id'], unique=False, schema='a76') - op.create_table('parts', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('client_id', sa.Integer(), nullable=False), - sa.Column('part_number', sa.String(length=50), nullable=False), - sa.Column('fraction', sa.String(length=10), nullable=True), - sa.Column('description_spanish', sa.String(length=500), nullable=True), - sa.Column('description_english', sa.String(length=500), nullable=True), - sa.Column('part_class', sa.String(length=8), nullable=True), - sa.Column('material_type', sa.String(length=10), nullable=True), - sa.Column('unit_of_measure', sa.String(length=5), nullable=True), - sa.Column('commercial_part_number', sa.String(length=70), nullable=True), - sa.Column('country_of_origin', sa.String(length=3), nullable=True), - sa.Column('unit_cost', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('currency_type', sa.String(length=2), nullable=True), - sa.Column('currency_key', sa.String(length=3), nullable=True), - sa.Column('unit_weight', sa.Numeric(precision=19, scale=8), nullable=True), - sa.Column('weight_type', sa.String(length=6), nullable=True), - sa.Column('us_fraction', sa.String(length=16), nullable=True), - sa.Column('fda_key', sa.String(length=20), nullable=True), - sa.Column('fcc_key', sa.String(length=30), nullable=True), - sa.Column('license_code', sa.String(length=3), nullable=True), - sa.Column('eccn', sa.String(length=20), nullable=True), - sa.Column('export_code', sa.String(length=2), nullable=True), - sa.Column('exclusion_symbol', sa.String(length=19), nullable=True), - sa.Column('supplier', sa.String(length=14), nullable=True), - sa.Column('alternate_unit_measure', sa.String(length=14), nullable=True), - sa.Column('added_value', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('is_active', sa.Boolean(), nullable=True), - sa.Column('creation_date', sa.Integer(), nullable=True), - sa.Column('modification_date', sa.Integer(), nullable=True), - sa.Column('modification_date_iso', sa.DateTime(), nullable=True), - sa.Column('part_photo', sa.String(length=255), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['country_of_origin'], ['public.countries.m3_key'], name='fk_parts_country'), - sa.ForeignKeyConstraint(['currency_key'], ['public.currency_types.code'], name='fk_parts_currency'), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.ForeignKeyConstraint(['unit_of_measure', 'tenant_id', 'company_id'], ['a76.units_of_measure.code', 'a76.units_of_measure.tenant_id', 'a76.units_of_measure.company_id'], ), - sa.PrimaryKeyConstraint('id', name='parts_pkey'), - sa.UniqueConstraint('tenant_id', 'company_id', 'part_number', name='client_part_ukey'), - schema='a76' - ) - op.create_index(op.f('ix_a76_parts_company_id'), 'parts', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_parts_tenant_id'), 'parts', ['tenant_id'], unique=False, schema='a76') - op.create_table('pedimentos', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('year', sa.String(length=2), nullable=False), - sa.Column('customs_office', sa.String(length=3), nullable=False), - sa.Column('license', sa.String(length=4), nullable=False), - sa.Column('pedimento_number', sa.String(length=7), nullable=False), - sa.Column('client_id', sa.Integer(), nullable=False), - sa.Column('operation_type', sa.Integer(), nullable=False), - sa.Column('pedimento_type', sa.String(length=20), nullable=False), - sa.Column('pedimento_code', sa.String(length=2), nullable=False), - sa.Column('regime', sa.String(length=3), nullable=False), - sa.Column('status', sa.String(length=30), nullable=True), - sa.Column('usd_value', sa.Numeric(precision=17, scale=6), nullable=True), - sa.Column('paid_price', sa.Numeric(precision=17, scale=6), nullable=True), - sa.Column('gross_weight', sa.Numeric(precision=19, scale=3), nullable=True), - sa.Column('exchange_rate', sa.Numeric(precision=9, scale=5), nullable=True), - sa.Column('observations', sa.Text(), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['client_id'], ['a76.clients_and_providers.id'], name='fk_pedimentos_client'), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['pedimento_code'], ['public.pedimento_codes.code'], name='fk_pedimentos_code'), - sa.ForeignKeyConstraint(['regime'], ['public.pedimento_regimens.code'], name='fk_pedimentos_regime'), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='pedimentos_pkey'), - sa.UniqueConstraint('tenant_id', 'company_id', 'year', 'customs_office', 'license', 'pedimento_number', name='pedimentos_unique_key'), - schema='a76' - ) - op.create_index('idx_pedimentos_client_id', 'pedimentos', ['client_id'], unique=False, schema='a76') - op.create_index('idx_pedimentos_created_at', 'pedimentos', ['created_at'], unique=False, schema='a76') - op.create_index('idx_pedimentos_status', 'pedimentos', ['status'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_pedimentos_company_id'), 'pedimentos', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_pedimentos_tenant_id'), 'pedimentos', ['tenant_id'], unique=False, schema='a76') - op.create_table('trailer', - sa.Column('trailer_number', sa.String(length=20), nullable=False), - sa.Column('ace_trailer_number', sa.String(length=10), nullable=True), - sa.Column('trailer_type_key', sa.String(length=2), nullable=True), - sa.Column('seal', sa.String(length=15), nullable=True), - sa.Column('entity_code', sa.String(length=1), nullable=True), - sa.Column('plate_number', sa.String(length=17), nullable=True), - sa.Column('state', sa.String(length=30), nullable=True), - sa.Column('country', sa.String(length=3), nullable=True), - sa.Column('container_key', sa.String(length=3), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.ForeignKeyConstraint(['trailer_type_key'], ['a76.trailer_type.trailer_type_key'], ), - sa.PrimaryKeyConstraint('trailer_number'), - schema='a76' - ) - op.create_index(op.f('ix_a76_trailer_company_id'), 'trailer', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_trailer_tenant_id'), 'trailer', ['tenant_id'], unique=False, schema='a76') - op.create_table('unit_conversions', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('from_unit_code', sa.String(length=5), nullable=False), - sa.Column('to_unit_code', sa.String(length=5), nullable=False), - sa.Column('conversion_factor', sa.Numeric(precision=13, scale=6), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['from_unit_code', 'tenant_id', 'company_id'], ['a76.units_of_measure.code', 'a76.units_of_measure.tenant_id', 'a76.units_of_measure.company_id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.ForeignKeyConstraint(['to_unit_code', 'tenant_id', 'company_id'], ['a76.units_of_measure.code', 'a76.units_of_measure.tenant_id', 'a76.units_of_measure.company_id'], ), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('from_unit_code', 'to_unit_code', 'tenant_id', 'company_id', name='uq_unit_conversion_pair'), - schema='a76' - ) - op.create_index(op.f('ix_a76_unit_conversions_company_id'), 'unit_conversions', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_unit_conversions_tenant_id'), 'unit_conversions', ['tenant_id'], unique=False, schema='a76') - op.create_table('fa_classes', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('class_id', sa.Integer(), nullable=False), - sa.Column('import_tariff_code', sa.String(length=10), nullable=False), - sa.Column('import_tariff_type', sa.String(length=6), nullable=False), - sa.Column('export_tariff_code', sa.String(length=10), nullable=False), - sa.Column('export_tariff_type', sa.String(length=6), nullable=False), - sa.Column('depreciation_rate', sa.Numeric(precision=5, scale=2), nullable=False), - sa.Column('fda_code', sa.String(length=20), nullable=False), - sa.Column('eccn_code', sa.String(length=20), nullable=False), - sa.Column('class_enabled', sa.Boolean(), nullable=False), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['class_id'], ['a76.classes.id'], name='fk_qclasses_classes'), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='qclases_pk'), - schema='a24' - ) - op.create_index(op.f('ix_a24_fa_classes_company_id'), 'fa_classes', ['company_id'], unique=False, schema='a24') - op.create_index(op.f('ix_a24_fa_classes_tenant_id'), 'fa_classes', ['tenant_id'], unique=False, schema='a24') - op.create_table('inv_classes', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('class_id', sa.Integer(), nullable=False), - sa.Column('stock_um', sa.String(length=5), nullable=False), - sa.Column('us_tariff_code', sa.String(length=19), nullable=False), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['class_id'], ['a76.classes.id'], name='fk_sclasses_classes'), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='sclases_pk'), - schema='a24' - ) - op.create_index(op.f('ix_a24_inv_classes_company_id'), 'inv_classes', ['company_id'], unique=False, schema='a24') - op.create_index(op.f('ix_a24_inv_classes_tenant_id'), 'inv_classes', ['tenant_id'], unique=False, schema='a24') - op.create_table('line_items', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('item_id', sa.Integer(), nullable=False), - sa.Column('asset_number', sa.String(length=25), nullable=True), - sa.Column('asset_photo', sa.String(length=255), nullable=True), - sa.Column('equipment_message', sa.String(length=40), nullable=True), - sa.Column('invoice_type_asset', sa.String(length=6), nullable=True), - sa.Column('return_import_invoice', sa.String(length=15), nullable=True), - sa.Column('return_import_date', sa.Integer(), nullable=True), - sa.Column('movement_type_import', sa.String(length=3), nullable=True), - sa.Column('search_invoice', sa.String(length=15), nullable=True), - sa.Column('search_line', sa.Integer(), nullable=True), - sa.Column('search_type', sa.String(length=10), nullable=True), - sa.Column('download', sa.Boolean(), nullable=True), - sa.Column('own_equipment', sa.Boolean(), nullable=True), - sa.Column('omit_annex31', sa.Boolean(), nullable=True), - sa.ForeignKeyConstraint(['item_id'], ['a76.items.id'], ), - sa.PrimaryKeyConstraint('id'), - schema='a24' - ) - op.create_table('doda_container_seals', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('container_id', sa.Integer(), nullable=False), - sa.Column('doda_id', sa.Integer(), nullable=False), - sa.Column('seal_line', sa.Integer(), nullable=False), - sa.Column('seal_value', sa.String(length=21), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['container_id'], ['a76.doda_containers.id'], name='fk_doda_container_seals_container'), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='doda_container_seals_pkey'), - schema='a76' - ) - op.create_index(op.f('ix_a76_doda_container_seals_company_id'), 'doda_container_seals', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_doda_container_seals_tenant_id'), 'doda_container_seals', ['tenant_id'], unique=False, schema='a76') - op.create_table('item_lines', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('item_id', sa.Integer(), nullable=False), - sa.Column('line_number', sa.Integer(), nullable=False), - sa.Column('part_number', sa.Integer(), nullable=True), - sa.Column('component_part_number', sa.Integer(), nullable=True), - sa.Column('class_code', sa.Integer(), nullable=True), - sa.Column('unit_of_measure', sa.Integer(), nullable=True), - sa.Column('alternate_unit', sa.Integer(), nullable=True), - sa.Column('uma_key', sa.String(length=2), nullable=True), - sa.Column('auxiliary_unit', sa.String(length=5), nullable=True), - sa.Column('permit_number', sa.String(length=20), nullable=True), - sa.Column('page_line', sa.String(length=10), nullable=True), - sa.Column('has_certificate', sa.Boolean(), nullable=True), - sa.Column('certificate_number', sa.String(length=10), nullable=True), - sa.Column('octave_permit', sa.String(length=20), nullable=True), - sa.Column('permits_ped', sa.String(length=500), nullable=True), - sa.Column('has_fda_code', sa.Boolean(), nullable=True), - sa.Column('fda_key', sa.String(length=10), nullable=True), - sa.Column('is_subitem', sa.Boolean(), nullable=True), - sa.Column('contains_subitems', sa.Boolean(), nullable=True), - sa.Column('includes_subitems', sa.Boolean(), nullable=True), - sa.Column('subitem_number', sa.Boolean(), nullable=True), - sa.Column('is_military_mcia', sa.Boolean(), nullable=True), - sa.Column('iv32_type_key', sa.String(length=5), nullable=True), - sa.Column('iv32_number', sa.String(length=35), nullable=True), - sa.Column('scrap_invoice', sa.String(length=15), nullable=True), - sa.Column('consecutive_destination', sa.Integer(), nullable=True), - sa.Column('ctm_section', sa.String(length=3), nullable=True), - sa.Column('tax_payment', sa.Boolean(), nullable=True), - sa.Column('payment_method', sa.String(length=9), nullable=True), - sa.Column('igi_amount', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('igi_payment_method', sa.String(length=9), nullable=True), - sa.Column('fcc_key', sa.String(length=30), nullable=True), - sa.Column('valuation_method', sa.String(length=2), nullable=True), - sa.Column('valuation_determined_value', sa.Numeric(precision=29, scale=8), nullable=True), - sa.Column('valuation_reason', sa.String(length=500), nullable=True), - sa.Column('container_rule', sa.String(length=50), nullable=True), - sa.Column('container_parts_ii', sa.String(length=50), nullable=True), - sa.Column('consecutive_aphis', sa.Integer(), nullable=True), - sa.Column('bom_version', sa.Integer(), nullable=True), - sa.Column('bill_version', sa.Integer(), nullable=True), - sa.Column('tlcan_value', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('identifier', sa.String(length=2), nullable=True), - sa.Column('validation_zero', sa.Integer(), nullable=True), - sa.Column('validation_one', sa.Integer(), nullable=True), - sa.Column('material_type', sa.String(length=50), nullable=True), - sa.Column('order_type', sa.String(length=50), nullable=True), - sa.Column('line_concept', sa.String(length=50), nullable=True), - sa.Column('review_dispatch', sa.String(length=10), nullable=True), - sa.Column('take_component_pt', sa.Integer(), nullable=True), - sa.Column('pallet2', sa.SmallInteger(), nullable=True), - sa.Column('wildcard_field', sa.String(length=100), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['alternate_unit'], ['a76.units_of_measure_general.id'], ), - sa.ForeignKeyConstraint(['class_code'], ['a76.classes.id'], ), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['component_part_number'], ['a76.parts.id'], ), - sa.ForeignKeyConstraint(['item_id'], ['a76.items.id'], ), - sa.ForeignKeyConstraint(['part_number'], ['a76.parts.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.ForeignKeyConstraint(['unit_of_measure'], ['a76.units_of_measure_general.id'], ), - sa.PrimaryKeyConstraint('id'), - schema='a76' - ) - op.create_index(op.f('ix_a76_item_lines_company_id'), 'item_lines', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_item_lines_tenant_id'), 'item_lines', ['tenant_id'], unique=False, schema='a76') - op.create_table('pedimento_config_additional', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('pedimento_id', sa.Integer(), nullable=False), - sa.Column('add_po_identifier', sa.SmallInteger(), nullable=False), - sa.Column('do_not_exempt_norms_complement_x', sa.SmallInteger(), nullable=False), - sa.Column('manual_pedimento_year', sa.String(length=2), nullable=False), - sa.Column('enable_import_invoice_recipient', sa.SmallInteger(), nullable=False), - sa.Column('send_502_validation_file_for_consolidated', sa.SmallInteger(), nullable=False), - sa.Column('add_remove_norms', sa.SmallInteger(), nullable=False), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['pedimento_id'], ['a76.pedimentos.id'], name='fk_pedimento_config_additional', ondelete='CASCADE'), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='pedimento_config_additional_pkey'), - sa.UniqueConstraint('tenant_id', 'company_id', 'pedimento_id', name='pedimento_config_additional_pedimento_id_key'), - schema='a76' - ) - op.create_index(op.f('ix_a76_pedimento_config_additional_company_id'), 'pedimento_config_additional', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_pedimento_config_additional_tenant_id'), 'pedimento_config_additional', ['tenant_id'], unique=False, schema='a76') - op.create_table('pedimento_config_calculations', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('pedimento_id', sa.Integer(), nullable=False), - sa.Column('dta_type', sa.String(length=1), nullable=True), - sa.Column('dta_operation', sa.Boolean(), server_default='false', nullable=False), - sa.Column('dta_vehicle_count', sa.SmallInteger(), server_default='0', nullable=False), - sa.Column('dta_mixed_rate_8permil', sa.Boolean(), server_default='false', nullable=False), - sa.Column('pays_vat', sa.Boolean(), server_default='false', nullable=False), - sa.Column('pays_prevalidation', sa.Boolean(), server_default='false', nullable=False), - sa.Column('include_sagar_certificate_fee', sa.Boolean(), server_default='false', nullable=False), - sa.Column('fixed_vehicle_dta_fee', sa.Boolean(), server_default='false', nullable=False), - sa.Column('additional_fixed_fee', sa.SmallInteger(), server_default='0', nullable=False), - sa.Column('additional_fixed_fee_payment_method', sa.SmallInteger(), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['pedimento_id'], ['a76.pedimentos.id'], name='fk_pedimento_config_calculations', ondelete='CASCADE'), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='pedimento_config_calculations_pkey'), - sa.UniqueConstraint('tenant_id', 'company_id', 'pedimento_id', name='pedimento_config_calculations_pedimento_id_key'), - schema='a76' - ) - op.create_index(op.f('ix_a76_pedimento_config_calculations_company_id'), 'pedimento_config_calculations', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_pedimento_config_calculations_tenant_id'), 'pedimento_config_calculations', ['tenant_id'], unique=False, schema='a76') - op.create_table('pedimento_config_parameters', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('pedimento_id', sa.Integer(), nullable=False), - sa.Column('is_embassy', sa.Boolean(), server_default='false', nullable=False), - sa.Column('embassy_dta', sa.Numeric(precision=11, scale=2), server_default='0.00', nullable=False), - sa.Column('rule_3121_section_ii', sa.Boolean(), server_default='false', nullable=False), - sa.Column('use_previous_tariff', sa.Boolean(), server_default='false', nullable=False), - sa.Column('use_payment_date_fi', sa.Boolean(), server_default='false', nullable=False), - sa.Column('add_state_supplier_record_505', sa.Boolean(), server_default='false', nullable=False), - sa.Column('customs_value_calculation', sa.Boolean(), server_default='false', nullable=False), - sa.Column('two_decimals_unit_value', sa.Boolean(), server_default='false', nullable=False), - sa.Column('customs_value_per_item', sa.Boolean(), server_default='false', nullable=False), - sa.Column('is_national_supplier', sa.Boolean(), server_default='false', nullable=False), - sa.Column('is_consolidated', sa.Boolean(), server_default='false', nullable=False), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['pedimento_id'], ['a76.pedimentos.id'], name='fk_pedimento_config_parameters', ondelete='CASCADE'), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='pedimento_config_parameters_pkey'), - sa.UniqueConstraint('tenant_id', 'company_id', 'pedimento_id', name='pedimento_config_parameters_pedimento_id_key'), - schema='a76' - ) - op.create_index(op.f('ix_a76_pedimento_config_parameters_company_id'), 'pedimento_config_parameters', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_pedimento_config_parameters_tenant_id'), 'pedimento_config_parameters', ['tenant_id'], unique=False, schema='a76') - op.create_table('pedimento_config_surcharges', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('pedimento_id', sa.Integer(), nullable=False), - sa.Column('surcharge_igi', sa.SmallInteger(), nullable=False), - sa.Column('surcharge_dta', sa.SmallInteger(), nullable=False), - sa.Column('surcharge_vat', sa.SmallInteger(), nullable=False), - sa.Column('surcharge_isan', sa.SmallInteger(), nullable=False), - sa.Column('surcharge_ieps', sa.SmallInteger(), nullable=False), - sa.Column('surcharge_cc', sa.SmallInteger(), nullable=False), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['pedimento_id'], ['a76.pedimentos.id'], name='fk_pedimento_config_surcharges', ondelete='CASCADE'), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='pedimento_config_surcharges_pkey'), - sa.UniqueConstraint('tenant_id', 'company_id', 'pedimento_id', name='pedimento_config_surcharges_pedimento_id_key'), - schema='a76' - ) - op.create_index(op.f('ix_a76_pedimento_config_surcharges_company_id'), 'pedimento_config_surcharges', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_pedimento_config_surcharges_tenant_id'), 'pedimento_config_surcharges', ['tenant_id'], unique=False, schema='a76') - op.create_table('pedimento_config_update_rectification', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('pedimento_id', sa.Integer(), nullable=False), - sa.Column('update_vat', sa.Boolean(), server_default='false', nullable=False), - sa.Column('update_advalorem', sa.Boolean(), server_default='false', nullable=False), - sa.Column('update_dta', sa.Boolean(), server_default='false', nullable=False), - sa.Column('update_cc', sa.Boolean(), server_default='false', nullable=False), - sa.Column('update_ieps', sa.Boolean(), server_default='false', nullable=False), - sa.Column('calculate_surcharge', sa.Boolean(), server_default='false', nullable=False), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['pedimento_id'], ['a76.pedimentos.id'], name='fk_pedimento_config_update_rectification', ondelete='CASCADE'), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='pedimento_config_update_rectification_pkey'), - sa.UniqueConstraint('tenant_id', 'company_id', 'pedimento_id', name='pedimento_config_update_rectification_pedimento_id_key'), - schema='a76' - ) - op.create_index(op.f('ix_a76_pedimento_config_update_rectification_company_id'), 'pedimento_config_update_rectification', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_pedimento_config_update_rectification_tenant_id'), 'pedimento_config_update_rectification', ['tenant_id'], unique=False, schema='a76') - op.create_table('pedimento_config_updates', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('pedimento_id', sa.Integer(), nullable=False), - sa.Column('update_vat', sa.Boolean(), server_default='false', nullable=False), - sa.Column('update_advalorem', sa.Boolean(), server_default='false', nullable=False), - sa.Column('update_dta', sa.Boolean(), server_default='false', nullable=False), - sa.Column('update_cc', sa.Boolean(), server_default='false', nullable=False), - sa.Column('update_ieps', sa.Boolean(), server_default='false', nullable=False), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['pedimento_id'], ['a76.pedimentos.id'], name='fk_pedimento_config_updates', ondelete='CASCADE'), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='pedimento_config_updates_pkey'), - sa.UniqueConstraint('tenant_id', 'company_id', 'pedimento_id', name='pedimento_config_updates_pedimento_id_key'), - schema='a76' - ) - op.create_index(op.f('ix_a76_pedimento_config_updates_company_id'), 'pedimento_config_updates', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_pedimento_config_updates_tenant_id'), 'pedimento_config_updates', ['tenant_id'], unique=False, schema='a76') - op.create_table('pedimento_customs_offices', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('pedimento_id', sa.Integer(), nullable=False), - sa.Column('dispatch_customs', sa.String(length=3), nullable=False), - sa.Column('entry_exit_customs', sa.String(length=3), nullable=False), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['pedimento_id'], ['a76.pedimentos.id'], name='fk_pedimento_customs_offices', ondelete='CASCADE'), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='pedimento_customs_offices_pkey'), - sa.UniqueConstraint('tenant_id', 'company_id', 'pedimento_id', name='pedimento_customs_offices_pedimento_id_key'), - schema='a76' - ) - op.create_index(op.f('ix_a76_pedimento_customs_offices_company_id'), 'pedimento_customs_offices', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_pedimento_customs_offices_tenant_id'), 'pedimento_customs_offices', ['tenant_id'], unique=False, schema='a76') - op.create_table('pedimento_dates', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('pedimento_id', sa.Integer(), nullable=False), - sa.Column('entry_date', sa.DateTime(), nullable=True), - sa.Column('pedimento_date', sa.DateTime(), nullable=True), - sa.Column('payment_date', sa.DateTime(), nullable=False), - sa.Column('rectification_payment_date', sa.DateTime(), nullable=True), - sa.Column('extraction_date', sa.DateTime(), nullable=True), - sa.Column('submission_date', sa.DateTime(), nullable=True), - sa.Column('eucan_date', sa.DateTime(), nullable=True), - sa.Column('original_date', sa.DateTime(), nullable=True), - sa.Column('start_date', sa.DateTime(), nullable=True), - sa.Column('end_date', sa.DateTime(), nullable=True), - sa.Column('capture_time', sa.Time(), nullable=False), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['pedimento_id'], ['a76.pedimentos.id'], name='fk_pedimento_dates', ondelete='CASCADE'), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='pedimento_dates_pkey'), - sa.UniqueConstraint('tenant_id', 'company_id', 'pedimento_id', name='pedimento_dates_pedimento_id_key'), - schema='a76' - ) - op.create_index('idx_pedimento_dates_pedimento_id', 'pedimento_dates', ['pedimento_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_pedimento_dates_company_id'), 'pedimento_dates', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_pedimento_dates_tenant_id'), 'pedimento_dates', ['tenant_id'], unique=False, schema='a76') - op.create_table('pedimento_decrementables', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('pedimento_id', sa.Integer(), nullable=False), - sa.Column('freight', sa.Numeric(precision=13, scale=2), nullable=False), - sa.Column('insurance', sa.Numeric(precision=13, scale=2), nullable=False), - sa.Column('loading', sa.Numeric(precision=13, scale=2), nullable=False), - sa.Column('unloading', sa.Numeric(precision=13, scale=2), nullable=False), - sa.Column('others', sa.Numeric(precision=13, scale=2), nullable=False), - sa.Column('currency', sa.String(length=3), nullable=False), - sa.Column('currency_factor', sa.Numeric(precision=15, scale=8), nullable=False), - sa.Column('not_affect_usd_value', sa.SmallInteger(), nullable=False), - sa.Column('not_affect_customs_value', sa.SmallInteger(), nullable=False), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['pedimento_id'], ['a76.pedimentos.id'], name='fk_pedimento_decrementables', ondelete='CASCADE'), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='pedimento_decrementables_pkey'), - sa.UniqueConstraint('tenant_id', 'company_id', 'pedimento_id', name='pedimento_decrementables_pedimento_id_key'), - schema='a76' - ) - op.create_index(op.f('ix_a76_pedimento_decrementables_company_id'), 'pedimento_decrementables', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_pedimento_decrementables_tenant_id'), 'pedimento_decrementables', ['tenant_id'], unique=False, schema='a76') - op.create_table('pedimento_incrementables', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('pedimento_id', sa.Integer(), nullable=False), - sa.Column('insured_value', sa.Numeric(precision=13, scale=2), nullable=False), - sa.Column('freight', sa.Numeric(precision=13, scale=2), nullable=False), - sa.Column('insurance', sa.Numeric(precision=13, scale=2), nullable=False), - sa.Column('packaging', sa.Numeric(precision=13, scale=2), nullable=False), - sa.Column('others', sa.Numeric(precision=13, scale=3), nullable=False), - sa.Column('deductibles', sa.Numeric(precision=13, scale=3), nullable=False), - sa.Column('currency', sa.String(length=3), nullable=False), - sa.Column('currency_factor', sa.Numeric(precision=15, scale=8), nullable=False), - sa.Column('not_affect_usd_value', sa.SmallInteger(), nullable=False), - sa.Column('not_affect_customs_value', sa.SmallInteger(), nullable=False), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['pedimento_id'], ['a76.pedimentos.id'], name='fk_pedimento_incrementables', ondelete='CASCADE'), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='pedimento_incrementables_pkey'), - sa.UniqueConstraint('tenant_id', 'company_id', 'pedimento_id', name='pedimento_incrementables_pedimento_id_key'), - schema='a76' - ) - op.create_index(op.f('ix_a76_pedimento_incrementables_company_id'), 'pedimento_incrementables', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_pedimento_incrementables_tenant_id'), 'pedimento_incrementables', ['tenant_id'], unique=False, schema='a76') - op.create_table('pedimento_indexes', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('pedimento_id', sa.Integer(), nullable=False), - sa.Column('update_factor_type', sa.SmallInteger(), nullable=False), - sa.Column('update_factor', sa.Numeric(precision=7, scale=4), nullable=False), - sa.Column('manual_update_factor', sa.SmallInteger(), nullable=False), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['pedimento_id'], ['a76.pedimentos.id'], name='fk_pedimento_indexes', ondelete='CASCADE'), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='pedimento_indexes_pkey'), - sa.UniqueConstraint('tenant_id', 'company_id', 'pedimento_id', name='pedimento_indexes_pedimento_id_key'), - schema='a76' - ) - op.create_index(op.f('ix_a76_pedimento_indexes_company_id'), 'pedimento_indexes', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_pedimento_indexes_tenant_id'), 'pedimento_indexes', ['tenant_id'], unique=False, schema='a76') - op.create_table('pedimento_payments', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('pedimento_id', sa.Integer(), nullable=False), - sa.Column('acknowledgment', sa.String(length=20), nullable=False), - sa.Column('operation_number', sa.String(length=14), nullable=False), - sa.Column('bank_code', sa.Integer(), nullable=False), - sa.Column('cashier', sa.String(length=2), nullable=False), - sa.Column('date', sa.Date(), nullable=False), - sa.Column('time', sa.Time(), nullable=False), - sa.Column('shift', sa.String(length=1), nullable=False), - sa.Column('total_cash_paid', sa.Integer(), nullable=False), - sa.Column('total_contributions', sa.Integer(), nullable=False), - sa.Column('counter_payment', sa.SmallInteger(), nullable=False), - sa.Column('pece_code', sa.String(length=5), nullable=False), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['pedimento_id'], ['a76.pedimentos.id'], name='fk_pedimento_payments', ondelete='CASCADE'), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='pedimento_payments_pkey'), - sa.UniqueConstraint('tenant_id', 'company_id', 'pedimento_id', name='pedimento_payments_pedimento_id_key'), - schema='a76' - ) - op.create_index('idx_pedimento_payments_pedimento_id', 'pedimento_payments', ['pedimento_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_pedimento_payments_company_id'), 'pedimento_payments', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_pedimento_payments_tenant_id'), 'pedimento_payments', ['tenant_id'], unique=False, schema='a76') - op.create_table('pedimento_rectification_destination', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('pedimento_id', sa.Integer(), nullable=False), - sa.Column('destination_pedimento_year', sa.String(length=2), nullable=False), - sa.Column('destination_customs_office', sa.String(length=3), nullable=False), - sa.Column('destination_license', sa.String(length=4), nullable=False), - sa.Column('destination_pedimento_number', sa.String(length=7), nullable=False), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['pedimento_id'], ['a76.pedimentos.id'], name='fk_pedimento_rectification_destination', ondelete='CASCADE'), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='pedimento_rectification_destination_pkey'), - sa.UniqueConstraint('tenant_id', 'company_id', 'pedimento_id', name='pedimento_rectification_destination_pedimento_id_key'), - schema='a76' - ) - op.create_index(op.f('ix_a76_pedimento_rectification_destination_company_id'), 'pedimento_rectification_destination', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_pedimento_rectification_destination_tenant_id'), 'pedimento_rectification_destination', ['tenant_id'], unique=False, schema='a76') - op.create_table('pedimento_rectification_origin', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('pedimento_id', sa.Integer(), nullable=False), - sa.Column('original_pedimento_year', sa.String(length=2), nullable=False), - sa.Column('original_customs_office', sa.String(length=3), nullable=False), - sa.Column('original_license', sa.String(length=4), nullable=False), - sa.Column('original_pedimento_number', sa.String(length=7), nullable=False), - sa.Column('original_pedimento_code', sa.String(length=2), nullable=False), - sa.Column('original_payment_date', sa.DateTime(), nullable=False), - sa.Column('total_cash', sa.Integer(), nullable=False), - sa.Column('total_others', sa.Integer(), nullable=False), - sa.Column('reason', sa.String(length=255), nullable=False), - sa.Column('charge_to_client', sa.SmallInteger(), nullable=False), - sa.Column('use_original_payment_date_for_interest_calc', sa.SmallInteger(), nullable=False), - sa.Column('manual_calculation', sa.SmallInteger(), nullable=False), - sa.Column('original_pedimento_norms', sa.SmallInteger(), nullable=False), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['pedimento_id'], ['a76.pedimentos.id'], name='fk_pedimento_rectification_origin', ondelete='CASCADE'), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='pedimento_rectification_origin_pkey'), - sa.UniqueConstraint('tenant_id', 'company_id', 'pedimento_id', name='pedimento_rectification_origin_pedimento_id_key'), - schema='a76' - ) - op.create_index(op.f('ix_a76_pedimento_rectification_origin_company_id'), 'pedimento_rectification_origin', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_pedimento_rectification_origin_tenant_id'), 'pedimento_rectification_origin', ['tenant_id'], unique=False, schema='a76') - op.create_table('pedimento_transport_means', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('pedimento_id', sa.Integer(), nullable=False), - sa.Column('destination', sa.SmallInteger(), nullable=False), - sa.Column('entry_exit', sa.String(length=2), nullable=False), - sa.Column('arrival', sa.String(length=2), nullable=False), - sa.Column('departure', sa.String(length=2), nullable=False), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['pedimento_id'], ['a76.pedimentos.id'], name='fk_pedimento_transport_means', ondelete='CASCADE'), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='pedimento_transport_means_pkey'), - sa.UniqueConstraint('tenant_id', 'company_id', 'pedimento_id', name='pedimento_transport_means_pedimento_id_key'), - schema='a76' - ) - op.create_index(op.f('ix_a76_pedimento_transport_means_company_id'), 'pedimento_transport_means', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_pedimento_transport_means_tenant_id'), 'pedimento_transport_means', ['tenant_id'], unique=False, schema='a76') - op.create_table('pedimento_validation', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('pedimento_id', sa.Integer(), nullable=False), - sa.Column('validator', sa.String(length=3), nullable=False), - sa.Column('validation_ack', sa.String(length=8), nullable=False), - sa.Column('pre_ack', sa.String(length=8), nullable=False), - sa.Column('line_signature', sa.String(length=50), nullable=False), - sa.Column('electronic_signature', sa.String(length=999), nullable=False), - sa.Column('certificate_number', sa.String(length=99), nullable=False), - sa.Column('validator_id', sa.Integer(), nullable=False), - sa.Column('responsible_id', sa.Integer(), nullable=False), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['pedimento_id'], ['a76.pedimentos.id'], name='fk_pedimento_validation', ondelete='CASCADE'), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id', name='pedimento_validation_pkey'), - sa.UniqueConstraint('tenant_id', 'company_id', 'pedimento_id', name='pedimento_validation_pedimento_id_key'), - schema='a76' - ) - op.create_index(op.f('ix_a76_pedimento_validation_company_id'), 'pedimento_validation', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_pedimento_validation_tenant_id'), 'pedimento_validation', ['tenant_id'], unique=False, schema='a76') - op.create_table('ctm_receipts', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('receipt_line', sa.Integer(), nullable=False), - sa.Column('option', sa.String(length=3), nullable=True), - sa.Column('exit_invoice', sa.String(length=19), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['receipt_line'], ['a76.item_lines.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id'), - schema='a76' - ) - op.create_index(op.f('ix_a76_ctm_receipts_company_id'), 'ctm_receipts', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_ctm_receipts_tenant_id'), 'ctm_receipts', ['tenant_id'], unique=False, schema='a76') - op.create_table('item_line_series', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('line_item_id', sa.Integer(), nullable=False), - sa.Column('row', sa.Integer(), nullable=False), - sa.Column('serial_numbers', sa.String(length=50), nullable=True), - sa.Column('model', sa.String(length=50), nullable=True), - sa.Column('sub_model', sa.String(length=50), nullable=True), - sa.Column('brand', sa.String(length=50), nullable=True), - sa.Column('expo_brad', sa.String(length=50), nullable=True), - sa.Column('number_id', sa.String(length=25), nullable=True), - sa.Column('tenant_id', sa.Integer(), nullable=False), - sa.Column('company_id', sa.Integer(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=False), - sa.Column('updated_at', sa.DateTime(), nullable=False), - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['company_id'], ['a76.company.id'], ), - sa.ForeignKeyConstraint(['line_item_id'], ['a76.item_lines.id'], ), - sa.ForeignKeyConstraint(['tenant_id'], ['core.tenants.id'], ), - sa.PrimaryKeyConstraint('id'), - schema='a76' - ) - op.create_index(op.f('ix_a76_item_line_series_company_id'), 'item_line_series', ['company_id'], unique=False, schema='a76') - op.create_index(op.f('ix_a76_item_line_series_tenant_id'), 'item_line_series', ['tenant_id'], unique=False, schema='a76') - op.create_table('line_customs', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('item_line_id', sa.Integer(), nullable=False), - sa.Column('fraction', sa.String(length=10), nullable=True), - sa.Column('fraction_type', sa.String(length=7), nullable=True), - sa.Column('american_fraction', sa.String(length=16), nullable=True), - sa.Column('alternate_fraction', sa.String(length=10), nullable=True), - sa.Column('reference_fraction', sa.String(length=10), nullable=True), - sa.Column('octave_fraction', sa.String(length=10), nullable=True), - sa.Column('tlcan_fraction', sa.String(length=13), nullable=True), - sa.Column('extra_american_fraction', sa.String(length=16), nullable=True), - sa.Column('garment_fraction', sa.String(length=19), nullable=True), - sa.Column('advalorem', sa.String(length=10), nullable=True), - sa.Column('advalorem_numeric', sa.Numeric(precision=7, scale=2), nullable=True), - sa.Column('advalorem_american', sa.Numeric(precision=5, scale=2), nullable=True), - sa.Column('advalorem_tlcan', sa.Numeric(precision=5, scale=2), nullable=True), - sa.Column('rate', sa.String(length=10), nullable=True), - sa.Column('depreciation_rate', sa.Numeric(precision=5, scale=2), nullable=True), - sa.Column('origin_country', sa.String(length=3), nullable=True), - sa.Column('destination_country', sa.String(length=3), nullable=True), - sa.Column('optional_country', sa.String(length=3), nullable=True), - sa.Column('origin_procedure', sa.String(length=3), nullable=True), - sa.Column('scrap_procedure', sa.String(length=3), nullable=True), - sa.Column('sector', sa.String(length=8), nullable=True), - sa.ForeignKeyConstraint(['item_line_id'], ['a76.item_lines.id'], ), - sa.PrimaryKeyConstraint('id'), - schema='a76' - ) - op.create_table('line_descriptions', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('item_line_id', sa.Integer(), nullable=False), - sa.Column('description_spanish', sa.String(length=4999), nullable=True), - sa.Column('description_english', sa.String(length=4999), nullable=True), - sa.Column('extra_description', sa.Text(), nullable=True), - sa.Column('part_description', sa.String(length=500), nullable=True), - sa.Column('class_description', sa.String(length=500), nullable=True), - sa.Column('brand', sa.String(length=50), nullable=True), - sa.Column('model', sa.String(length=50), nullable=True), - sa.Column('has_serial', sa.Boolean(), nullable=True), - sa.Column('additional_info_spanish', sa.String(length=1000), nullable=True), - sa.Column('additional_info_english', sa.String(length=1000), nullable=True), - sa.Column('lot', sa.String(length=254), nullable=True), - sa.Column('entry_number', sa.String(length=50), nullable=True), - sa.ForeignKeyConstraint(['item_line_id'], ['a76.item_lines.id'], ), - sa.PrimaryKeyConstraint('id'), - schema='a76' - ) - op.create_table('line_financials', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('item_line_id', sa.Integer(), nullable=False), - sa.Column('unit_cost_capture', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('unit_cost_usd', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('unit_cost_commercial_usd', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('unit_cost_current_usd', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('unit_cost_depreciated_usd', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('unit_cost_subitem_usd', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('unit_cost_auxiliary_usd', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('sales_cost_usd', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('commercial_unit_cost', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('unit_cost_mxn', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('unit_cost_commercial_mxn', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('unit_cost_current_mxn', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('unit_cost_depreciated_mxn', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('unit_cost_subitem_mxn', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('sales_cost_mxn', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('unit_cost_mc', sa.Numeric(precision=29, scale=8), nullable=True), - sa.Column('value_mxn', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('value_commercial_mxn', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('value_updated_mxn', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('value_subitem_mxn', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('sub_import_value_mxn', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('value_returned_mxn', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('value_depreciated_mxn', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('customs_value_mxn', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('value_total_mxn', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('value_temp_material_mxn', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('value_def_material_mxn', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('value_added_mxn', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('value_national_packing_mxn', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('vat_mxn', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('vat_used_mxn', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('advalorem_line_mxn', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('value_usd', sa.Numeric(precision=29, scale=8), nullable=True), - sa.Column('value_commercial_usd', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('value_updated_usd', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('value_subitem_usd', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('sub_import_value_usd', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('value_returned_usd', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('value_depreciated_usd', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('customs_value_usd', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('value_auxiliary_usd', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('value_total_usd', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('value_temp_material_usd', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('value_def_material_usd', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('value_added_usd', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('value_national_packing_usd', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('value_us_packing_usd', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('vat_usd', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('vat_used_usd', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('value_non_originating_usd', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('value_originating_usd', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('igi_amount_usd', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('exempt_amount_usd', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('total_commercial_value', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('advalorem_line_usd', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('value_mc', sa.Numeric(precision=29, scale=8), nullable=True), - sa.Column('sub_import_value_mc', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('vat_mc', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('value_added_mc', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('value_national_packing_mc', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('value_total_mc', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('value_temp_material_mc', sa.Numeric(precision=23, scale=8), nullable=True), - sa.Column('value_def_material_mc', sa.Numeric(precision=23, scale=8), nullable=True), - sa.ForeignKeyConstraint(['item_line_id'], ['a76.item_lines.id'], ), - sa.PrimaryKeyConstraint('id'), - schema='a76' - ) - op.create_table('line_quantities', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('item_line_id', sa.Integer(), nullable=False), - sa.Column('quantity', sa.Numeric(precision=19, scale=8), nullable=True), - sa.Column('alternate_quantity', sa.Numeric(precision=19, scale=8), nullable=True), - sa.Column('quantity_uma', sa.Numeric(precision=19, scale=8), nullable=True), - sa.Column('auxiliary_quantity', sa.Numeric(precision=19, scale=8), nullable=True), - sa.Column('quantity_temp_export', sa.Numeric(precision=19, scale=8), nullable=True), - sa.Column('quantity_existence', sa.Numeric(precision=19, scale=8), nullable=True), - sa.Column('quantity_returned', sa.Numeric(precision=19, scale=8), nullable=True), - sa.Column('quantity_returned_temp', sa.Numeric(precision=19, scale=8), nullable=True), - sa.Column('serial_count', sa.Integer(), nullable=True), - sa.Column('weight_unit', sa.String(length=3), nullable=True), - sa.Column('net_weight', sa.Numeric(precision=19, scale=8), nullable=True), - sa.Column('gross_weight', sa.Numeric(precision=19, scale=8), nullable=True), - sa.Column('package_key', sa.String(length=5), nullable=True), - sa.Column('package_quantity', sa.Integer(), nullable=True), - sa.Column('package_description', sa.String(length=40), nullable=True), - sa.Column('container_quantity', sa.SmallInteger(), nullable=True), - sa.Column('container_description', sa.String(length=40), nullable=True), - sa.Column('box_count', sa.String(length=30), nullable=True), - sa.ForeignKeyConstraint(['item_line_id'], ['a76.item_lines.id'], ), - sa.PrimaryKeyConstraint('id'), - schema='a76' - ) - op.create_table('line_references', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('item_line_id', sa.Integer(), nullable=False), - sa.Column('serie_id', sa.Integer(), nullable=True), - sa.Column('customer_invoice', sa.Integer(), nullable=True), - sa.Column('assigned_client', sa.Integer(), nullable=True), - sa.Column('supplier', sa.Integer(), nullable=True), - sa.Column('requisitioner', sa.Integer(), nullable=True), - sa.Column('sent_to', sa.Integer(), nullable=True), - sa.Column('ped_line', sa.Integer(), nullable=True), - sa.Column('ro_line', sa.Integer(), nullable=True), - sa.ForeignKeyConstraint(['assigned_client'], ['a76.clients_and_providers.id'], ), - sa.ForeignKeyConstraint(['customer_invoice'], ['a76.clients_and_providers.id'], ), - sa.ForeignKeyConstraint(['item_line_id'], ['a76.item_lines.id'], ), - sa.ForeignKeyConstraint(['requisitioner'], ['a76.clients_and_providers.id'], ), - sa.ForeignKeyConstraint(['sent_to'], ['a76.clients_and_providers.id'], ), - sa.ForeignKeyConstraint(['serie_id'], ['a76.item_line_series.id'], ), - sa.ForeignKeyConstraint(['supplier'], ['a76.clients_and_providers.id'], ), - sa.PrimaryKeyConstraint('id'), - schema='a76' - ) - op.drop_constraint(op.f('fk_codeped'), 'code_pedimento_regimens', type_='foreignkey') - op.drop_constraint(op.f('fk_regimenped'), 'code_pedimento_regimens', type_='foreignkey') - op.create_foreign_key('fk_codeped', 'code_pedimento_regimens', 'pedimento_codes', ['pedimento_code'], ['code'], source_schema='public', referent_schema='public') - op.create_foreign_key('fk_regimenped', 'code_pedimento_regimens', 'pedimento_regimens', ['regimen_code'], ['code'], source_schema='public', referent_schema='public') - # ### end Alembic commands ### - - -def downgrade() -> None: - """Downgrade schema.""" - # ### commands auto generated by Alembic - please adjust! ### - op.drop_constraint('fk_regimenped', 'code_pedimento_regimens', schema='public', type_='foreignkey') - op.drop_constraint('fk_codeped', 'code_pedimento_regimens', schema='public', type_='foreignkey') - op.create_foreign_key(op.f('fk_regimenped'), 'code_pedimento_regimens', 'pedimento_regimens', ['regimen_code'], ['code']) - op.create_foreign_key(op.f('fk_codeped'), 'code_pedimento_regimens', 'pedimento_codes', ['pedimento_code'], ['code']) - op.drop_table('line_references', schema='a76') - op.drop_table('line_quantities', schema='a76') - op.drop_table('line_financials', schema='a76') - op.drop_table('line_descriptions', schema='a76') - op.drop_table('line_customs', schema='a76') - op.drop_index(op.f('ix_a76_item_line_series_tenant_id'), table_name='item_line_series', schema='a76') - op.drop_index(op.f('ix_a76_item_line_series_company_id'), table_name='item_line_series', schema='a76') - op.drop_table('item_line_series', schema='a76') - op.drop_index(op.f('ix_a76_ctm_receipts_tenant_id'), table_name='ctm_receipts', schema='a76') - op.drop_index(op.f('ix_a76_ctm_receipts_company_id'), table_name='ctm_receipts', schema='a76') - op.drop_table('ctm_receipts', schema='a76') - op.drop_index(op.f('ix_a76_pedimento_validation_tenant_id'), table_name='pedimento_validation', schema='a76') - op.drop_index(op.f('ix_a76_pedimento_validation_company_id'), table_name='pedimento_validation', schema='a76') - op.drop_table('pedimento_validation', schema='a76') - op.drop_index(op.f('ix_a76_pedimento_transport_means_tenant_id'), table_name='pedimento_transport_means', schema='a76') - op.drop_index(op.f('ix_a76_pedimento_transport_means_company_id'), table_name='pedimento_transport_means', schema='a76') - op.drop_table('pedimento_transport_means', schema='a76') - op.drop_index(op.f('ix_a76_pedimento_rectification_origin_tenant_id'), table_name='pedimento_rectification_origin', schema='a76') - op.drop_index(op.f('ix_a76_pedimento_rectification_origin_company_id'), table_name='pedimento_rectification_origin', schema='a76') - op.drop_table('pedimento_rectification_origin', schema='a76') - op.drop_index(op.f('ix_a76_pedimento_rectification_destination_tenant_id'), table_name='pedimento_rectification_destination', schema='a76') - op.drop_index(op.f('ix_a76_pedimento_rectification_destination_company_id'), table_name='pedimento_rectification_destination', schema='a76') - op.drop_table('pedimento_rectification_destination', schema='a76') - op.drop_index(op.f('ix_a76_pedimento_payments_tenant_id'), table_name='pedimento_payments', schema='a76') - op.drop_index(op.f('ix_a76_pedimento_payments_company_id'), table_name='pedimento_payments', schema='a76') - op.drop_index('idx_pedimento_payments_pedimento_id', table_name='pedimento_payments', schema='a76') - op.drop_table('pedimento_payments', schema='a76') - op.drop_index(op.f('ix_a76_pedimento_indexes_tenant_id'), table_name='pedimento_indexes', schema='a76') - op.drop_index(op.f('ix_a76_pedimento_indexes_company_id'), table_name='pedimento_indexes', schema='a76') - op.drop_table('pedimento_indexes', schema='a76') - op.drop_index(op.f('ix_a76_pedimento_incrementables_tenant_id'), table_name='pedimento_incrementables', schema='a76') - op.drop_index(op.f('ix_a76_pedimento_incrementables_company_id'), table_name='pedimento_incrementables', schema='a76') - op.drop_table('pedimento_incrementables', schema='a76') - op.drop_index(op.f('ix_a76_pedimento_decrementables_tenant_id'), table_name='pedimento_decrementables', schema='a76') - op.drop_index(op.f('ix_a76_pedimento_decrementables_company_id'), table_name='pedimento_decrementables', schema='a76') - op.drop_table('pedimento_decrementables', schema='a76') - op.drop_index(op.f('ix_a76_pedimento_dates_tenant_id'), table_name='pedimento_dates', schema='a76') - op.drop_index(op.f('ix_a76_pedimento_dates_company_id'), table_name='pedimento_dates', schema='a76') - op.drop_index('idx_pedimento_dates_pedimento_id', table_name='pedimento_dates', schema='a76') - op.drop_table('pedimento_dates', schema='a76') - op.drop_index(op.f('ix_a76_pedimento_customs_offices_tenant_id'), table_name='pedimento_customs_offices', schema='a76') - op.drop_index(op.f('ix_a76_pedimento_customs_offices_company_id'), table_name='pedimento_customs_offices', schema='a76') - op.drop_table('pedimento_customs_offices', schema='a76') - op.drop_index(op.f('ix_a76_pedimento_config_updates_tenant_id'), table_name='pedimento_config_updates', schema='a76') - op.drop_index(op.f('ix_a76_pedimento_config_updates_company_id'), table_name='pedimento_config_updates', schema='a76') - op.drop_table('pedimento_config_updates', schema='a76') - op.drop_index(op.f('ix_a76_pedimento_config_update_rectification_tenant_id'), table_name='pedimento_config_update_rectification', schema='a76') - op.drop_index(op.f('ix_a76_pedimento_config_update_rectification_company_id'), table_name='pedimento_config_update_rectification', schema='a76') - op.drop_table('pedimento_config_update_rectification', schema='a76') - op.drop_index(op.f('ix_a76_pedimento_config_surcharges_tenant_id'), table_name='pedimento_config_surcharges', schema='a76') - op.drop_index(op.f('ix_a76_pedimento_config_surcharges_company_id'), table_name='pedimento_config_surcharges', schema='a76') - op.drop_table('pedimento_config_surcharges', schema='a76') - op.drop_index(op.f('ix_a76_pedimento_config_parameters_tenant_id'), table_name='pedimento_config_parameters', schema='a76') - op.drop_index(op.f('ix_a76_pedimento_config_parameters_company_id'), table_name='pedimento_config_parameters', schema='a76') - op.drop_table('pedimento_config_parameters', schema='a76') - op.drop_index(op.f('ix_a76_pedimento_config_calculations_tenant_id'), table_name='pedimento_config_calculations', schema='a76') - op.drop_index(op.f('ix_a76_pedimento_config_calculations_company_id'), table_name='pedimento_config_calculations', schema='a76') - op.drop_table('pedimento_config_calculations', schema='a76') - op.drop_index(op.f('ix_a76_pedimento_config_additional_tenant_id'), table_name='pedimento_config_additional', schema='a76') - op.drop_index(op.f('ix_a76_pedimento_config_additional_company_id'), table_name='pedimento_config_additional', schema='a76') - op.drop_table('pedimento_config_additional', schema='a76') - op.drop_index(op.f('ix_a76_item_lines_tenant_id'), table_name='item_lines', schema='a76') - op.drop_index(op.f('ix_a76_item_lines_company_id'), table_name='item_lines', schema='a76') - op.drop_table('item_lines', schema='a76') - op.drop_index(op.f('ix_a76_doda_container_seals_tenant_id'), table_name='doda_container_seals', schema='a76') - op.drop_index(op.f('ix_a76_doda_container_seals_company_id'), table_name='doda_container_seals', schema='a76') - op.drop_table('doda_container_seals', schema='a76') - op.drop_table('line_items', schema='a24') - op.drop_index(op.f('ix_a24_inv_classes_tenant_id'), table_name='inv_classes', schema='a24') - op.drop_index(op.f('ix_a24_inv_classes_company_id'), table_name='inv_classes', schema='a24') - op.drop_table('inv_classes', schema='a24') - op.drop_index(op.f('ix_a24_fa_classes_tenant_id'), table_name='fa_classes', schema='a24') - op.drop_index(op.f('ix_a24_fa_classes_company_id'), table_name='fa_classes', schema='a24') - op.drop_table('fa_classes', schema='a24') - op.drop_index(op.f('ix_a76_unit_conversions_tenant_id'), table_name='unit_conversions', schema='a76') - op.drop_index(op.f('ix_a76_unit_conversions_company_id'), table_name='unit_conversions', schema='a76') - op.drop_table('unit_conversions', schema='a76') - op.drop_index(op.f('ix_a76_trailer_tenant_id'), table_name='trailer', schema='a76') - op.drop_index(op.f('ix_a76_trailer_company_id'), table_name='trailer', schema='a76') - op.drop_table('trailer', schema='a76') - op.drop_index(op.f('ix_a76_pedimentos_tenant_id'), table_name='pedimentos', schema='a76') - op.drop_index(op.f('ix_a76_pedimentos_company_id'), table_name='pedimentos', schema='a76') - op.drop_index('idx_pedimentos_status', table_name='pedimentos', schema='a76') - op.drop_index('idx_pedimentos_created_at', table_name='pedimentos', schema='a76') - op.drop_index('idx_pedimentos_client_id', table_name='pedimentos', schema='a76') - op.drop_table('pedimentos', schema='a76') - op.drop_index(op.f('ix_a76_parts_tenant_id'), table_name='parts', schema='a76') - op.drop_index(op.f('ix_a76_parts_company_id'), table_name='parts', schema='a76') - op.drop_table('parts', schema='a76') - op.drop_index(op.f('ix_a76_items_tenant_id'), table_name='items', schema='a76') - op.drop_index(op.f('ix_a76_items_company_id'), table_name='items', schema='a76') - op.drop_table('items', schema='a76') - op.drop_index(op.f('ix_a76_invoice_sales_details_tenant_id'), table_name='invoice_sales_details', schema='a76') - op.drop_index(op.f('ix_a76_invoice_sales_details_company_id'), table_name='invoice_sales_details', schema='a76') - op.drop_table('invoice_sales_details', schema='a76') - op.drop_index(op.f('ix_a76_invoice_logistics_tenant_id'), table_name='invoice_logistics', schema='a76') - op.drop_index(op.f('ix_a76_invoice_logistics_company_id'), table_name='invoice_logistics', schema='a76') - op.drop_table('invoice_logistics', schema='a76') - op.drop_index(op.f('ix_a76_invoice_financials_tenant_id'), table_name='invoice_financials', schema='a76') - op.drop_index(op.f('ix_a76_invoice_financials_company_id'), table_name='invoice_financials', schema='a76') - op.drop_table('invoice_financials', schema='a76') - op.drop_index(op.f('ix_a76_invoice_compliance_mx_tenant_id'), table_name='invoice_compliance_mx', schema='a76') - op.drop_index(op.f('ix_a76_invoice_compliance_mx_company_id'), table_name='invoice_compliance_mx', schema='a76') - op.drop_table('invoice_compliance_mx', schema='a76') - op.drop_index(op.f('ix_a76_invoice_collections_tenant_id'), table_name='invoice_collections', schema='a76') - op.drop_index(op.f('ix_a76_invoice_collections_company_id'), table_name='invoice_collections', schema='a76') - op.drop_table('invoice_collections', schema='a76') - op.drop_index(op.f('ix_a76_identifier_details_tenant_id'), table_name='identifier_details', schema='a76') - op.drop_index(op.f('ix_a76_identifier_details_company_id'), table_name='identifier_details', schema='a76') - op.drop_table('identifier_details', schema='a76') - op.drop_index(op.f('ix_a76_error_catalogs_tenant_id'), table_name='error_catalogs', schema='a76') - op.drop_index(op.f('ix_a76_error_catalogs_company_id'), table_name='error_catalogs', schema='a76') - op.drop_table('error_catalogs', schema='a76') - op.drop_index(op.f('ix_a76_equivalency_items_tenant_id'), table_name='equivalency_items', schema='a76') - op.drop_index(op.f('ix_a76_equivalency_items_company_id'), table_name='equivalency_items', schema='a76') - op.drop_table('equivalency_items', schema='a76') - op.drop_index(op.f('ix_a76_driver_tenant_id'), table_name='driver', schema='a76') - op.drop_index(op.f('ix_a76_driver_company_id'), table_name='driver', schema='a76') - op.drop_table('driver', schema='a76') - op.drop_index(op.f('ix_a76_doda_pedimentos_tenant_id'), table_name='doda_pedimentos', schema='a76') - op.drop_index(op.f('ix_a76_doda_pedimentos_company_id'), table_name='doda_pedimentos', schema='a76') - op.drop_table('doda_pedimentos', schema='a76') - op.drop_index(op.f('ix_a76_doda_containers_tenant_id'), table_name='doda_containers', schema='a76') - op.drop_index(op.f('ix_a76_doda_containers_company_id'), table_name='doda_containers', schema='a76') - op.drop_table('doda_containers', schema='a76') - op.drop_index(op.f('ix_a76_doda_american_pedimentos_tenant_id'), table_name='doda_american_pedimentos', schema='a76') - op.drop_index(op.f('ix_a76_doda_american_pedimentos_company_id'), table_name='doda_american_pedimentos', schema='a76') - op.drop_table('doda_american_pedimentos', schema='a76') - op.drop_index(op.f('ix_a76_customs_brokers_vu_tenant_id'), table_name='customs_brokers_vu', schema='a76') - op.drop_index(op.f('ix_a76_customs_brokers_vu_company_id'), table_name='customs_brokers_vu', schema='a76') - op.drop_table('customs_brokers_vu', schema='a76') - op.drop_index(op.f('ix_a76_customs_brokers_personnel_tenant_id'), table_name='customs_brokers_personnel', schema='a76') - op.drop_index(op.f('ix_a76_customs_brokers_personnel_company_id'), table_name='customs_brokers_personnel', schema='a76') - op.drop_table('customs_brokers_personnel', schema='a76') - op.drop_index(op.f('ix_a76_country_rule_oct_tenant_id'), table_name='country_rule_oct', schema='a76') - op.drop_index(op.f('ix_a76_country_rule_oct_company_id'), table_name='country_rule_oct', schema='a76') - op.drop_table('country_rule_oct', schema='a76') - op.drop_index(op.f('ix_a76_concepts_tenant_id'), table_name='concepts', schema='a76') - op.drop_table('concepts', schema='a76') - op.drop_index(op.f('ix_a76_clients_and_providers_programs_tenant_id'), table_name='clients_and_providers_programs', schema='a76') - op.drop_index(op.f('ix_a76_clients_and_providers_programs_company_id'), table_name='clients_and_providers_programs', schema='a76') - op.drop_table('clients_and_providers_programs', schema='a76') - op.drop_index(op.f('ix_a76_clients_and_providers_address_tenant_id'), table_name='clients_and_providers_address', schema='a76') - op.drop_index(op.f('ix_a76_clients_and_providers_address_company_id'), table_name='clients_and_providers_address', schema='a76') - op.drop_table('clients_and_providers_address', schema='a76') - op.drop_index(op.f('ix_a76_classes_tenant_id'), table_name='classes', schema='a76') - op.drop_index(op.f('ix_a76_classes_company_id'), table_name='classes', schema='a76') - op.drop_table('classes', schema='a76') - op.drop_index(op.f('ix_core_user_tenants_tenant_id'), table_name='user_tenants', schema='core') - op.drop_index(op.f('ix_core_user_tenants_keycloak_user_id'), table_name='user_tenants', schema='core') - op.drop_index(op.f('ix_core_user_tenants_id'), table_name='user_tenants', schema='core') - op.drop_index(op.f('ix_core_user_tenants_company_id'), table_name='user_tenants', schema='core') - op.drop_table('user_tenants', schema='core') - op.drop_index(op.f('ix_a76_vehicle_tenant_id'), table_name='vehicle', schema='a76') - op.drop_index(op.f('ix_a76_vehicle_company_id'), table_name='vehicle', schema='a76') - op.drop_table('vehicle', schema='a76') - op.drop_index(op.f('ix_a76_units_of_measure_general_tenant_id'), table_name='units_of_measure_general', schema='a76') - op.drop_index(op.f('ix_a76_units_of_measure_general_company_id'), table_name='units_of_measure_general', schema='a76') - op.drop_table('units_of_measure_general', schema='a76') - op.drop_index(op.f('ix_a76_units_of_measure_tenant_id'), table_name='units_of_measure', schema='a76') - op.drop_index(op.f('ix_a76_units_of_measure_company_id'), table_name='units_of_measure', schema='a76') - op.drop_table('units_of_measure', schema='a76') - op.drop_index(op.f('ix_a76_unit_of_measure_oma_tenant_id'), table_name='unit_of_measure_oma', schema='a76') - op.drop_index(op.f('ix_a76_unit_of_measure_oma_company_id'), table_name='unit_of_measure_oma', schema='a76') - op.drop_table('unit_of_measure_oma', schema='a76') - op.drop_index(op.f('ix_a76_unit_of_measure_customs_tenant_id'), table_name='unit_of_measure_customs', schema='a76') - op.drop_index(op.f('ix_a76_unit_of_measure_customs_company_id'), table_name='unit_of_measure_customs', schema='a76') - op.drop_table('unit_of_measure_customs', schema='a76') - op.drop_index(op.f('ix_a76_unit_of_measure_american_tenant_id'), table_name='unit_of_measure_american', schema='a76') - op.drop_index(op.f('ix_a76_unit_of_measure_american_company_id'), table_name='unit_of_measure_american', schema='a76') - op.drop_table('unit_of_measure_american', schema='a76') - op.drop_index(op.f('ix_a76_unit_of_measure_ace_tenant_id'), table_name='unit_of_measure_ace', schema='a76') - op.drop_index(op.f('ix_a76_unit_of_measure_ace_company_id'), table_name='unit_of_measure_ace', schema='a76') - op.drop_table('unit_of_measure_ace', schema='a76') - op.drop_index(op.f('ix_a76_transporter_tenant_id'), table_name='transporter', schema='a76') - op.drop_index(op.f('ix_a76_transporter_company_id'), table_name='transporter', schema='a76') - op.drop_table('transporter', schema='a76') - op.drop_index(op.f('ix_a76_trailer_type_tenant_id'), table_name='trailer_type', schema='a76') - op.drop_index(op.f('ix_a76_trailer_type_company_id'), table_name='trailer_type', schema='a76') - op.drop_table('trailer_type', schema='a76') - op.drop_index(op.f('ix_a76_subassembly_entries_tenant_id'), table_name='subassembly_entries', schema='a76') - op.drop_index(op.f('ix_a76_subassembly_entries_company_id'), table_name='subassembly_entries', schema='a76') - op.drop_table('subassembly_entries', schema='a76') - op.drop_index(op.f('ix_a76_signatures_tenant_id'), table_name='signatures', schema='a76') - op.drop_index(op.f('ix_a76_signatures_company_id'), table_name='signatures', schema='a76') - op.drop_table('signatures', schema='a76') - op.drop_index(op.f('ix_a76_seal_tenant_id'), table_name='seal', schema='a76') - op.drop_index(op.f('ix_a76_seal_company_id'), table_name='seal', schema='a76') - op.drop_table('seal', schema='a76') - op.drop_index(op.f('ix_a76_prevalidators_tenant_id'), table_name='prevalidators', schema='a76') - op.drop_index(op.f('ix_a76_prevalidators_company_id'), table_name='prevalidators', schema='a76') - op.drop_table('prevalidators', schema='a76') - op.drop_index(op.f('ix_a76_ports_tenant_id'), table_name='ports', schema='a76') - op.drop_index(op.f('ix_a76_ports_company_id'), table_name='ports', schema='a76') - op.drop_table('ports', schema='a76') - op.drop_index(op.f('ix_a76_permission_rule_oct_tenant_id'), table_name='permission_rule_oct', schema='a76') - op.drop_index(op.f('ix_a76_permission_rule_oct_company_id'), table_name='permission_rule_oct', schema='a76') - op.drop_table('permission_rule_oct', schema='a76') - op.drop_index(op.f('ix_a76_packing_lists_tenant_id'), table_name='packing_lists', schema='a76') - op.drop_index(op.f('ix_a76_packing_lists_company_id'), table_name='packing_lists', schema='a76') - op.drop_table('packing_lists', schema='a76') - op.drop_index(op.f('ix_a76_packages_tenant_id'), table_name='packages', schema='a76') - op.drop_index(op.f('ix_a76_packages_company_id'), table_name='packages', schema='a76') - op.drop_table('packages', schema='a76') - op.drop_index(op.f('ix_a76_multi_currency_types_tenant_id'), table_name='multi_currency_types', schema='a76') - op.drop_index(op.f('ix_a76_multi_currency_types_company_id'), table_name='multi_currency_types', schema='a76') - op.drop_table('multi_currency_types', schema='a76') - op.drop_index(op.f('ix_a76_legends_tenant_id'), table_name='legends', schema='a76') - op.drop_index(op.f('ix_a76_legends_company_id'), table_name='legends', schema='a76') - op.drop_table('legends', schema='a76') - op.drop_index(op.f('ix_a76_invoice_header_tenant_id'), table_name='invoice_header', schema='a76') - op.drop_index(op.f('ix_a76_invoice_header_company_id'), table_name='invoice_header', schema='a76') - op.drop_table('invoice_header', schema='a76') - op.drop_index(op.f('ix_a76_inpc_tenant_id'), table_name='inpc', schema='a76') - op.drop_index(op.f('ix_a76_inpc_company_id'), table_name='inpc', schema='a76') - op.drop_table('inpc', schema='a76') - op.drop_index(op.f('ix_a76_identifiers_tenant_id'), table_name='identifiers', schema='a76') - op.drop_index(op.f('ix_a76_identifiers_company_id'), table_name='identifiers', schema='a76') - op.drop_table('identifiers', schema='a76') - op.drop_index(op.f('ix_a76_fraction_rule_octave_tenant_id'), table_name='fraction_rule_octave', schema='a76') - op.drop_index(op.f('ix_a76_fraction_rule_octave_company_id'), table_name='fraction_rule_octave', schema='a76') - op.drop_table('fraction_rule_octave', schema='a76') - op.drop_index(op.f('ix_a76_exchange_rate_tenant_id'), table_name='exchange_rate', schema='a76') - op.drop_index(op.f('ix_a76_exchange_rate_company_id'), table_name='exchange_rate', schema='a76') - op.drop_table('exchange_rate', schema='a76') - op.drop_index(op.f('ix_a76_error_classifications_tenant_id'), table_name='error_classifications', schema='a76') - op.drop_index(op.f('ix_a76_error_classifications_company_id'), table_name='error_classifications', schema='a76') - op.drop_table('error_classifications', schema='a76') - op.drop_index(op.f('ix_a76_equivalencies_tenant_id'), table_name='equivalencies', schema='a76') - op.drop_index(op.f('ix_a76_equivalencies_company_id'), table_name='equivalencies', schema='a76') - op.drop_table('equivalencies', schema='a76') - op.drop_index(op.f('ix_a76_electronic_notices_tenant_id'), table_name='electronic_notices', schema='a76') - op.drop_index(op.f('ix_a76_electronic_notices_company_id'), table_name='electronic_notices', schema='a76') - op.drop_table('electronic_notices', schema='a76') - op.drop_index(op.f('ix_a76_doda_tenant_id'), table_name='doda', schema='a76') - op.drop_index(op.f('ix_a76_doda_company_id'), table_name='doda', schema='a76') - op.drop_table('doda', schema='a76') - op.drop_index(op.f('ix_a76_customs_brokers_tenant_id'), table_name='customs_brokers', schema='a76') - op.drop_index(op.f('ix_a76_customs_brokers_company_id'), table_name='customs_brokers', schema='a76') - op.drop_table('customs_brokers', schema='a76') - op.drop_index(op.f('ix_a76_clients_and_providers_tenant_id'), table_name='clients_and_providers', schema='a76') - op.drop_index(op.f('ix_a76_clients_and_providers_company_id'), table_name='clients_and_providers', schema='a76') - op.drop_table('clients_and_providers', schema='a76') - op.drop_index(op.f('ix_a76_classification_concepts_tenant_id'), table_name='classification_concepts', schema='a76') - op.drop_index(op.f('ix_a76_classification_concepts_company_id'), table_name='classification_concepts', schema='a76') - op.drop_table('classification_concepts', schema='a76') - op.drop_index(op.f('ix_a24_location_tenant_id'), table_name='location', schema='a24') - op.drop_index(op.f('ix_a24_location_company_id'), table_name='location', schema='a24') - op.drop_table('location', schema='a24') - op.drop_index(op.f('ix_core_licenses_tenant_id'), table_name='licenses', schema='core') - op.drop_index(op.f('ix_core_licenses_id'), table_name='licenses', schema='core') - op.drop_table('licenses', schema='core') - op.drop_index(op.f('ix_core_license_usage_tenant_id'), table_name='license_usage', schema='core') - op.drop_index(op.f('ix_core_license_usage_id'), table_name='license_usage', schema='core') - op.drop_table('license_usage', schema='core') - op.drop_index(op.f('ix_a76_customs_broker_concepts_tenant_id'), table_name='customs_broker_concepts', schema='a76') - op.drop_table('customs_broker_concepts', schema='a76') - op.drop_index(op.f('ix_a76_company_tenant_id'), table_name='company', schema='a76') - op.drop_table('company', schema='a76') - op.drop_index(op.f('ix_core_tenants_slug'), table_name='tenants', schema='core') - op.drop_index(op.f('ix_core_tenants_name'), table_name='tenants', schema='core') - op.drop_index(op.f('ix_core_tenants_id'), table_name='tenants', schema='core') - op.drop_table('tenants', schema='core') - # ### end Alembic commands ### diff --git a/backend/api/v1/modules/a76/parts/models.py b/backend/api/v1/modules/a76/parts/models.py index a5da21c2..db56d294 100644 --- a/backend/api/v1/modules/a76/parts/models.py +++ b/backend/api/v1/modules/a76/parts/models.py @@ -1,6 +1,7 @@ """ Modelos ORM para gestión de partes/componentes - Anexo 76 (Master Data) """ + from datetime import datetime from decimal import Decimal from typing import TYPE_CHECKING, Optional @@ -8,19 +9,29 @@ from typing import TYPE_CHECKING, Optional from api.v1.common.base_models import TenantScopedMixin, TimestampMixin from core.database import Base from sqlalchemy import ( - ForeignKeyConstraint, Integer, Numeric, PrimaryKeyConstraint, - String, UniqueConstraint, Boolean, DateTime + ForeignKeyConstraint, + Integer, + Numeric, + PrimaryKeyConstraint, + String, + UniqueConstraint, + Boolean, + DateTime, ) + # Importante usar relationship y Mapped from sqlalchemy.orm import Mapped, mapped_column, relationship if TYPE_CHECKING: from api.v1.modules.a76.classes.models import Class from api.v1.modules.public.reference_data.currency_types.models import CurrencyType - from api.v1.modules.a76.general_catalogs.units_of_measure.models import UnitOfMeasure + from api.v1.modules.a76.general_catalogs.units_of_measure.models import ( + UnitOfMeasure, + ) from api.v1.modules.a24.fa.fa_parts.models import FaPart from api.v1.modules.a24.inv.inv_parts.models import InvPart + class Part(Base, TenantScopedMixin, TimestampMixin): __tablename__ = "parts" __table_args__ = ( @@ -30,14 +41,21 @@ class Part(Base, TenantScopedMixin, TimestampMixin): ), ForeignKeyConstraint( ["unit_of_measure", "tenant_id", "company_id"], - ["a76.units_of_measure.code", "a76.units_of_measure.tenant_id", - "a76.units_of_measure.company_id"], + [ + "a76.units_of_measure.code", + "a76.units_of_measure.tenant_id", + "a76.units_of_measure.company_id", + ], ), # Puente hacia la tabla de clases ForeignKeyConstraint( ["part_class", "tenant_id", "company_id"], - ["a76.classes.class_code", "a76.classes.tenant_id", "a76.classes.company_id"], - name="fk_parts_class" + [ + "a76.classes.class_code", + "a76.classes.tenant_id", + "a76.classes.company_id", + ], + name="fk_parts_class", ), UniqueConstraint( "tenant_id", "company_id", "part_number", name="client_part_ukey" @@ -54,7 +72,7 @@ class Part(Base, TenantScopedMixin, TimestampMixin): description_english: Mapped[Optional[str]] = mapped_column(String(500)) part_class: Mapped[Optional[str]] = mapped_column(String(8)) unit_of_measure: Mapped[Optional[str]] = mapped_column(String(5)) - + unit_cost: Mapped[Optional[Decimal]] = mapped_column(Numeric(23, 8)) currency_type: Mapped[Optional[str]] = mapped_column(String(2)) currency_key: Mapped[Optional[str]] = mapped_column(String(3)) @@ -73,31 +91,33 @@ class Part(Base, TenantScopedMixin, TimestampMixin): is_active: Mapped[Optional[bool]] = mapped_column(Boolean, default=True) part_photo: Mapped[Optional[str]] = mapped_column(String(255)) - + creation_date: Mapped[Optional[int]] = mapped_column() modification_date: Mapped[Optional[int]] = mapped_column() modification_date_iso: Mapped[Optional[datetime]] = mapped_column(DateTime) - # --- RELACIONES CORREGIDAS --- - currency: Mapped[Optional["CurrencyType"]] = relationship( - foreign_keys="[Part.currency_key]" - ) + # --- RELACIONES --- + currency: Mapped[Optional["CurrencyType"]] = relationship("CurrencyType") unit_of_measure_info: Mapped[Optional["UnitOfMeasure"]] = relationship( - foreign_keys="[Part.unit_of_measure, Part.tenant_id, Part.company_id]" + "UnitOfMeasure" ) part_class_info: Mapped[Optional["Class"]] = relationship( - "Class", - back_populates="parts", - foreign_keys="[Part.part_class, Part.tenant_id, Part.company_id]" + "Class", back_populates="parts", overlaps="unit_of_measure_info" ) # Extensiones Anexo 24 fa_data: Mapped[Optional["FaPart"]] = relationship( - "FaPart", back_populates="master_info", uselist=False, cascade="all, delete-orphan" + "FaPart", + back_populates="master_info", + uselist=False, + cascade="all, delete-orphan", ) inv_data: Mapped[Optional["InvPart"]] = relationship( - "InvPart", back_populates="master_info", uselist=False, cascade="all, delete-orphan" + "InvPart", + back_populates="master_info", + uselist=False, + cascade="all, delete-orphan", ) def __repr__(self) -> str: - return f"" \ No newline at end of file + return f"" diff --git a/backend/main.py b/backend/main.py index c497cc46..c567450d 100644 --- a/backend/main.py +++ b/backend/main.py @@ -19,12 +19,12 @@ from fastapi.middleware.cors import CORSMiddleware from fastapi.exceptions import RequestValidationError from fastapi.responses import JSONResponse -from api.v1.modules.a76.items.models import ( - Item, -) # Importar rutas para registrar con el router -from api.v1.modules.a76.items.series.models import ( - Serie, -) # Importar modelos para registrar con SQLAlchemy +# Importar modelos para registrar con SQLAlchemy +from api.v1.modules.a76.items.models import Item +from api.v1.modules.a76.items.series.models import Serie +from api.v1.modules.a76.parts.models import Part +from api.v1.modules.a24.fa.fa_parts.models import FaPart +from api.v1.modules.a24.inv.inv_parts.models import InvPart # Configurar logging logging.basicConfig( @@ -51,7 +51,9 @@ register_exception_handlers(app) # Add validation error handler @app.exception_handler(RequestValidationError) async def validation_exception_handler(request: Request, exc: RequestValidationError): - logger.error(f"Validation error for {request.method} {request.url.path}: {exc.errors()}") + logger.error( + f"Validation error for {request.method} {request.url.path}: {exc.errors()}" + ) logger.error(f"Request body: {await request.body()}") return JSONResponse( status_code=status.HTTP_400_BAD_REQUEST, @@ -62,7 +64,9 @@ async def validation_exception_handler(request: Request, exc: RequestValidationE # Add HTTP exception handler @app.exception_handler(HTTPException) async def http_exception_handler(request: Request, exc: HTTPException): - logger.error(f"HTTP {exc.status_code} for {request.method} {request.url.path}: {exc.detail}") + logger.error( + f"HTTP {exc.status_code} for {request.method} {request.url.path}: {exc.detail}" + ) return JSONResponse( status_code=exc.status_code, content={"detail": exc.detail}, diff --git a/frontend/src/lib/components/dashboard/goods/parts/partForm.svelte b/frontend/src/lib/components/dashboard/goods/parts/partForm.svelte index bed5413b..9e5f34c8 100644 --- a/frontend/src/lib/components/dashboard/goods/parts/partForm.svelte +++ b/frontend/src/lib/components/dashboard/goods/parts/partForm.svelte @@ -107,14 +107,14 @@ description_spanish: d.description_spanish || '', description_english: d.description_english || '', part_class: d.part_class || '', - material_type: (d as any).material_type || '', - origin_country: d.origin_country || 'MEX', + material_type: d.inv_data?.material_type || '', + origin_country: d.fa_data?.origin_country || 'MEX', unit_of_measure: d.unit_of_measure || 'PZ', fraction: d.fraction || '', us_fraction: d.us_fraction || '', unit_weight: Number(d.unit_weight) || 0, weight_type: d.weight_type || 'KG', - supplier: d.supplier || '', + supplier: d.inv_data?.supplier_code || '', fda_key: d.fda_key || '', fcc_key: d.fcc_key || '', eccn: d.eccn || '', @@ -123,10 +123,10 @@ exclusion_symbol: d.exclusion_symbol || '', unit_cost: Number(d.unit_cost) || 0, currency_key: d.currency_key || 'USD', - added_value: Number(d.added_value) || 0, + added_value: Number(d.inv_data?.added_value) || 0, value_added_type: 'USD', commercial_part_number: d.commercial_part_number || '', - alternate_unit_measure: d.alternate_unit_measure || '', + alternate_unit_measure: d.inv_data?.alternate_uom || '', part_photo: d.part_photo || '', is_active: d.is_active ?? true, // Cargar datos FA si existen @@ -135,7 +135,7 @@ }; if (d.client_id) await fetchClientName(d.client_id, companyId); if (d.part_class) await fetchClassDesc(d.part_class, companyId); - if ((d as any).material_type) await fetchMaterialName((d as any).material_type); + if (d.inv_data?.material_type) await fetchMaterialName(d.inv_data.material_type); } } catch (e) { console.error(e); } finally { loading = false; } } diff --git a/frontend/src/routes/dashboard/goods/parts/+page.svelte b/frontend/src/routes/dashboard/goods/parts/+page.svelte index 25ea479f..dae74cc6 100644 --- a/frontend/src/routes/dashboard/goods/parts/+page.svelte +++ b/frontend/src/routes/dashboard/goods/parts/+page.svelte @@ -1,7 +1,7 @@ \ No newline at end of file