- Implemented SQLAlchemy models for incoterms, invoice types, material types, payment methods, pedimento codes, pedimento regimens, sectors, states, transport modes, transport types, and valuation methods. - Added seed data for each reference data model to populate the database with initial values. - Ensured primary key constraints and appropriate data types for each model. - Established relationships where necessary, particularly in pedimento codes and regimens.
16 lines
638 B
Python
16 lines
638 B
Python
from sqlalchemy import String, PrimaryKeyConstraint
|
|
from sqlalchemy.orm import mapped_column, Mapped
|
|
from core.database import Base
|
|
|
|
class Container(Base):
|
|
__tablename__ = "containers" #GContenedores
|
|
__table_args__ = (
|
|
PrimaryKeyConstraint("key", name="containers_pkey"),
|
|
{"schema": "public"} # opcional
|
|
)
|
|
|
|
key: Mapped[str] = mapped_column(String(3), nullable=False) # mantiene ceros iniciales
|
|
description: Mapped[str] = mapped_column(String(500), nullable=False) # descripción legal en español
|
|
|
|
def __repr__(self):
|
|
return f"<Container(key={self.key}, description={self.description})>" |