core/orm/community.py

17 lines
741 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'
# id is auto number
name: str = Column(String, nullable=False, comment="Name")
slug: str = Column(String, unique = True, nullable = False)
desc: str = Column(String, nullable=False, default='')
pic: str = Column(String, nullable=False, default='')
2021-08-27 08:42:01 +00:00
# org_id: str = Column(ForeignKey("organization.id"), nullable=True)
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")