- Updated `TimestampMixin` to use `server_default` for `created_at` and `updated_at` fields. - Modified various models in the `fa_classes`, `doc_types_dig`, `ports`, `units_of_measure`, `invoices`, `parts`, `trailers`, `licenses`, `tenants`, and `user_tenant` modules to set `server_default` for boolean fields and other relevant fields. - Adjusted the `trailer_types` model to change the schema from `a76` to `public`. - Implemented database migration execution during application startup in `main.py`. - Removed old Alembic migration execution logic from the entrypoint script. - Updated seed data for units of measure and removed unused seed files.
23 lines
870 B
Python
23 lines
870 B
Python
from api.v1.common.base_models import TenantScopedMixin, TimestampMixin
|
|
from core.database import Base
|
|
from sqlalchemy import Column, ForeignKey, ForeignKeyConstraint, String
|
|
|
|
|
|
class Trailer(Base, TenantScopedMixin, TimestampMixin):
|
|
__tablename__ = "trailer"
|
|
__table_args__ = (
|
|
{"schema": "a76"},
|
|
)
|
|
|
|
trailer_number = Column(String(20), primary_key=True, nullable=False)
|
|
ace_trailer_number = Column(String(10), nullable=True)
|
|
trailer_type_key = Column(
|
|
String(2), ForeignKey("public.trailer_type.trailer_type_key"), nullable=True
|
|
)
|
|
seal = Column(String(15), nullable=True)
|
|
entity_code = Column(String(1), nullable=True)
|
|
plate_number = Column(String(17), nullable=True)
|
|
state = Column(String(30), nullable=True)
|
|
country = Column(String(3), nullable=True)
|
|
container_key = Column(String(3), nullable=True)
|