25 lines
598 B
Python
25 lines
598 B
Python
from sqlalchemy import Boolean, Column, ForeignKey, Integer, String
|
|
from sqlalchemy.orm import relationship
|
|
|
|
from databases.mssql.database import Base
|
|
|
|
|
|
class Region(Base):
|
|
__tablename__ = "regions"
|
|
|
|
id = Column( Integer, primary_key= True, index= True)
|
|
name = Column(String(255))
|
|
active = Column(Boolean, default=True)
|
|
|
|
|
|
|
|
class City(Base):
|
|
__tablename__ = "cities"
|
|
|
|
id = Column(Integer, autoincrement= True, primary_key= True, index= True)
|
|
name = Column(String(255))
|
|
region_id = Column(Integer, ForeignKey(regions.id))
|
|
active = Column(Boolean, default= True)
|
|
|
|
|