Add Country model

This commit is contained in:
Backend IM Bot 2025-03-25 19:50:17 +01:00
parent 6a9358ca49
commit 469f3115b9

17
models/country.py Normal file
View File

@ -0,0 +1,17 @@
from sqlalchemy import Column, String, Integer
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.sql import func
from app.api.db.base_class import Base
import uuid
class Country(Base):
__tablename__ = "countries"
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
name = Column(String, nullable=False, unique=True, index=True)
code = Column(String(3), nullable=False, unique=True, index=True)
population = Column(Integer, nullable=False)
area = Column(Integer, nullable=False)
created_at = Column(Integer, default=func.now(), nullable=False)
updated_at = Column(Integer, default=func.now(), onupdate=func.now(), nullable=False)