core/orm/community.py

16 lines
661 B
Python
Raw Normal View History

2021-08-26 21:14:20 +00:00
from datetime import datetime
from sqlalchemy import Column, Integer, String, ForeignKey, DateTime
from sqlalchemy.orm import relationship, backref
from orm.base import Base
class Community(Base):
__tablename__ = 'community'
2021-08-28 10:13:50 +00:00
# id is auto number
2021-08-26 21:14:20 +00:00
name: str = Column(String, nullable=False, comment="Name")
slug: str = Column(String, unique = True, nullable = False)
2021-08-28 10:13:50 +00:00
desc: str = Column(String, nullable=False, default='')
pic: str = Column(String, nullable=False, default='')
2021-08-26 21:14:20 +00:00
createdAt: str = Column(DateTime, nullable=False, default = datetime.now, comment="Created at")
createdBy: str = Column(ForeignKey("user.id"), nullable=False, comment="Creator")