Add State model
This commit is contained in:
parent
d5e3b77542
commit
3f2897e729
17
models/state.py
Normal file
17
models/state.py
Normal file
@ -0,0 +1,17 @@
|
||||
from sqlalchemy import Column, String, Integer, Boolean, DateTime, ForeignKey
|
||||
from sqlalchemy.orm import relationship
|
||||
from sqlalchemy.sql import func
|
||||
from core.db.base_class import Base
|
||||
import uuid
|
||||
|
||||
class State(Base):
|
||||
__tablename__ = "states"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
name = Column(String, unique=True, nullable=False, index=True)
|
||||
abbreviation = Column(String, unique=True, nullable=False, index=True)
|
||||
is_active = Column(Boolean, default=True)
|
||||
|
||||
# Timestamps
|
||||
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