Add Country model
This commit is contained in:
parent
8e976f9331
commit
c9d334601c
18
models/country.py
Normal file
18
models/country.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
from sqlalchemy import Column, String, DateTime
|
||||||
|
from sqlalchemy.sql import func
|
||||||
|
from core.database import Base
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
class Country(Base):
|
||||||
|
__tablename__ = "countries"
|
||||||
|
|
||||||
|
id = Column(String, primary_key=True, default=lambda: str(uuid.uuid4()))
|
||||||
|
name = Column(String, nullable=False, index=True)
|
||||||
|
code = Column(String, nullable=False, unique=True)
|
||||||
|
capital = Column(String)
|
||||||
|
region = Column(String)
|
||||||
|
subregion = Column(String)
|
||||||
|
population = Column(String)
|
||||||
|
flag = Column(String)
|
||||||
|
created_at = Column(DateTime, default=func.now())
|
||||||
|
updated_at = Column(DateTime, default=func.now(), onupdate=func.now())
|
Loading…
x
Reference in New Issue
Block a user