allow-base

This commit is contained in:
tonyrewin 2023-01-31 10:36:54 +03:00
parent 0da0313435
commit b9b7d330d2
5 changed files with 3 additions and 5 deletions

View File

@ -28,7 +28,9 @@ class Base(declarative_base()):
__tablename__: str __tablename__: str
__new__: Callable __new__: Callable
__init__: Callable __init__: Callable
# qualify the base with __allow_unmapped__. Can also be
# applied to classes directly if preferred
__allow_unmapped__ = True
__abstract__: bool = True __abstract__: bool = True
__table_args__ = {"extend_existing": True} __table_args__ = {"extend_existing": True}
id: int = Column(Integer, primary_key=True) id: int = Column(Integer, primary_key=True)

View File

@ -18,7 +18,6 @@ class CommunityFollower(Base):
class Community(Base): class Community(Base):
__tablename__ = "community" __tablename__ = "community"
__allow_unmapped__ = True
name = Column(String, nullable=False, comment="Name") name = Column(String, nullable=False, comment="Name")
slug = Column(String, nullable=False, unique=True, comment="Slug") slug = Column(String, nullable=False, unique=True, comment="Slug")

View File

@ -30,7 +30,6 @@ class ClassType(TypeDecorator):
class Role(Base): class Role(Base):
__tablename__ = "role" __tablename__ = "role"
__allow_unmapped__ = True
name = Column(String, nullable=False, comment="Role Name") name = Column(String, nullable=False, comment="Role Name")
desc = Column(String, nullable=True, comment="Role Description") desc = Column(String, nullable=True, comment="Role Description")

View File

@ -41,7 +41,6 @@ class ShoutAuthor(Base):
class Shout(Base): class Shout(Base):
__tablename__ = "shout" __tablename__ = "shout"
__allow_unmapped__ = True
slug = Column(String, unique=True) slug = Column(String, unique=True)
community = Column(ForeignKey("community.id"), default=1) community = Column(ForeignKey("community.id"), default=1)

View File

@ -19,7 +19,6 @@ class TopicFollower(Base):
class Topic(Base): class Topic(Base):
__tablename__ = "topic" __tablename__ = "topic"
__allow_unmapped__ = True
slug = Column(String, unique=True) slug = Column(String, unique=True)
title = Column(String, nullable=False, comment="Title") title = Column(String, nullable=False, comment="Title")