feat(states): add initial seed data and update State model with foreign key
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
from typing import Optional
|
||||
|
||||
from core.database import Base
|
||||
from sqlalchemy import PrimaryKeyConstraint, String
|
||||
from sqlalchemy import ForeignKey, PrimaryKeyConstraint, String
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
|
||||
@@ -12,12 +12,11 @@ class State(Base):
|
||||
{"schema": "public", "extend_existing": True},
|
||||
)
|
||||
|
||||
m3_key: Mapped[str] = mapped_column(String(3), nullable=False)
|
||||
m3_key: Mapped[str] = mapped_column(ForeignKey("public.countries.m3_key"), nullable=False)
|
||||
description: Mapped[str] = mapped_column(
|
||||
String(50), nullable=False
|
||||
) # valor legal en español
|
||||
mex_key: Mapped[Optional[str]] = mapped_column(String(3))
|
||||
ame_key: Mapped[Optional[str]] = mapped_column(String(2))
|
||||
mex_key: Mapped[Optional[str]] = mapped_column(String(3))
|
||||
|
||||
def __repr__(self):
|
||||
return f"<State(m3_key={self.m3_key}, description={self.description}, mex_key={self.mex_key}, ame_key={self.ame_key})>"
|
||||
|
||||
Reference in New Issue
Block a user