Add State model
This commit is contained in:
parent
0edebf0738
commit
261711731b
12
models/state.py
Normal file
12
models/state.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
from sqlalchemy import Column, String, DateTime
|
||||||
|
from sqlalchemy.sql import func
|
||||||
|
from core.database import Base
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
class State(Base):
|
||||||
|
__tablename__ = "states"
|
||||||
|
id = Column(String, primary_key=True, default=lambda: str(uuid.uuid4()))
|
||||||
|
name = Column(String, unique=True, nullable=False, index=True)
|
||||||
|
country_code = Column(String(2), nullable=False, index=True)
|
||||||
|
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