fdsfsd
This commit is contained in:
parent
e849aa7d54
commit
22b56f5ed4
10 changed files with 25 additions and 25 deletions
|
@ -65,10 +65,10 @@ class AwardRelationship(Base):
|
|||
comment_id = Column(Integer, ForeignKey("comments.id"), default=None)
|
||||
kind = Column(String(20))
|
||||
|
||||
user = relationship("User", primaryjoin="AwardRelationship.user_id==User.id", lazy="joined")
|
||||
user = relationship("User", primaryjoin="AwardRelationship.user_id==User.id")
|
||||
|
||||
post = relationship("Submission", primaryjoin="AwardRelationship.submission_id==Submission.id", lazy="joined")
|
||||
comment = relationship("Comment", primaryjoin="AwardRelationship.comment_id==Comment.id", lazy="joined")
|
||||
post = relationship("Submission", primaryjoin="AwardRelationship.submission_id==Submission.id")
|
||||
comment = relationship("Comment", primaryjoin="AwardRelationship.comment_id==Comment.id")
|
||||
|
||||
|
||||
@property
|
||||
|
|
|
@ -48,7 +48,7 @@ class Badge(Base):
|
|||
badge_id = Column(Integer, ForeignKey("badge_defs.id"))
|
||||
description = Column(String(64))
|
||||
url = Column(String(256))
|
||||
badge = relationship("BadgeDef", lazy="joined", innerjoin=True)
|
||||
badge = relationship("BadgeDef")
|
||||
|
||||
def __repr__(self):
|
||||
|
||||
|
|
|
@ -68,8 +68,8 @@ class ClientAuth(Base):
|
|||
oauth_client = Column(Integer, ForeignKey("oauth_apps.id"))
|
||||
access_token = Column(String(128))
|
||||
user_id = Column(Integer, ForeignKey("users.id"))
|
||||
user = relationship("User", lazy="joined")
|
||||
application = relationship("OauthApp", lazy="joined")
|
||||
user = relationship("User")
|
||||
application = relationship("OauthApp")
|
||||
|
||||
@property
|
||||
@lazy
|
||||
|
|
|
@ -28,7 +28,7 @@ class Comment(Base):
|
|||
__tablename__ = "comments"
|
||||
|
||||
id = Column(Integer, primary_key=True)
|
||||
comment_aux = relationship("CommentAux", lazy="joined", uselist=False, innerjoin=True, primaryjoin="Comment.id==CommentAux.id")
|
||||
comment_aux = relationship("CommentAux", uselist=False, primaryjoin="Comment.id==CommentAux.id")
|
||||
author_id = Column(Integer, ForeignKey("users.id"))
|
||||
parent_submission = Column(Integer, ForeignKey("submissions.id"))
|
||||
# this column is foreignkeyed to comment(id) but we can't do that yet as
|
||||
|
@ -54,7 +54,7 @@ class Comment(Base):
|
|||
|
||||
post = relationship("Submission")
|
||||
flags = relationship("CommentFlag", lazy="dynamic")
|
||||
author = relationship("User", lazy="joined", innerjoin=True, primaryjoin="User.id==Comment.author_id")
|
||||
author = relationship("User", primaryjoin="User.id==Comment.author_id")
|
||||
|
||||
upvotes = Column(Integer, default=1)
|
||||
downvotes = Column(Integer, default=0)
|
||||
|
@ -62,7 +62,7 @@ class Comment(Base):
|
|||
parent_comment = relationship("Comment", remote_side=[id])
|
||||
child_comments = relationship("Comment", remote_side=[parent_comment_id])
|
||||
|
||||
awards = relationship("AwardRelationship", lazy="joined")
|
||||
awards = relationship("AwardRelationship")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
||||
|
@ -408,8 +408,8 @@ class Notification(Base):
|
|||
blocksender = Column(Integer)
|
||||
unblocksender = Column(Integer)
|
||||
|
||||
comment = relationship("Comment", lazy="joined", innerjoin=True)
|
||||
user=relationship("User", innerjoin=True)
|
||||
comment = relationship("Comment")
|
||||
user=relationship("User")
|
||||
|
||||
def __repr__(self):
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ class Flag(Base):
|
|||
user_id = Column(Integer, ForeignKey("users.id"))
|
||||
reason = Column(String(100))
|
||||
|
||||
user = relationship("User", lazy = "joined", primaryjoin = "Flag.user_id == User.id", uselist = False)
|
||||
user = relationship("User", primaryjoin = "Flag.user_id == User.id", uselist = False)
|
||||
|
||||
def __repr__(self):
|
||||
|
||||
|
@ -39,7 +39,7 @@ class CommentFlag(Base):
|
|||
comment_id = Column(Integer, ForeignKey("comments.id"))
|
||||
reason = Column(String(100))
|
||||
|
||||
user = relationship("User", lazy = "joined", primaryjoin = "CommentFlag.user_id == User.id", uselist = False)
|
||||
user = relationship("User", primaryjoin = "CommentFlag.user_id == User.id", uselist = False)
|
||||
|
||||
def __repr__(self):
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ class ModAction(Base):
|
|||
_note=Column(String(256), default=None)
|
||||
created_utc = Column(Integer, default=0)
|
||||
|
||||
user = relationship("User", lazy="joined", primaryjoin="User.id==ModAction.user_id")
|
||||
target_user = relationship("User", lazy="joined", primaryjoin="User.id==ModAction.target_user_id")
|
||||
target_post = relationship("Submission", lazy="joined")
|
||||
user = relationship("User", primaryjoin="User.id==ModAction.user_id")
|
||||
target_user = relationship("User", primaryjoin="User.id==ModAction.target_user_id")
|
||||
target_post = relationship("Submission")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
if "created_utc" not in kwargs:
|
||||
|
|
|
@ -33,7 +33,7 @@ class Submission(Base):
|
|||
__tablename__ = "submissions"
|
||||
|
||||
id = Column(BigInteger, primary_key=True)
|
||||
submission_aux = relationship("SubmissionAux", lazy="joined", uselist=False, innerjoin=True, primaryjoin="Submission.id==SubmissionAux.id")
|
||||
submission_aux = relationship("SubmissionAux", uselist=False, primaryjoin="Submission.id==SubmissionAux.id")
|
||||
author_id = Column(BigInteger, ForeignKey("users.id"))
|
||||
edited_utc = Column(BigInteger, default=0)
|
||||
created_utc = Column(BigInteger, default=0)
|
||||
|
@ -51,11 +51,11 @@ class Submission(Base):
|
|||
private = Column(Boolean, default=False)
|
||||
club = Column(Boolean, default=False)
|
||||
comment_count = Column(Integer, default=0)
|
||||
comments = relationship("Comment", lazy="joined", primaryjoin="Comment.parent_submission==Submission.id")
|
||||
comments = relationship("Comment", primaryjoin="Comment.parent_submission==Submission.id")
|
||||
flags = relationship("Flag", lazy="dynamic")
|
||||
is_approved = Column(Integer, ForeignKey("users.id"), default=0)
|
||||
over_18 = Column(Boolean, default=False)
|
||||
author = relationship("User", lazy="joined", innerjoin=True, primaryjoin="Submission.author_id==User.id")
|
||||
author = relationship("User", primaryjoin="Submission.author_id==User.id")
|
||||
is_pinned = Column(Boolean, default=False)
|
||||
is_bot = Column(Boolean, default=False)
|
||||
|
||||
|
@ -67,7 +67,7 @@ class Submission(Base):
|
|||
|
||||
approved_by = relationship("User", uselist=False, primaryjoin="Submission.is_approved==User.id")
|
||||
|
||||
awards = relationship("AwardRelationship", lazy="joined")
|
||||
awards = relationship("AwardRelationship")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ class Follow(Base):
|
|||
target_id = Column(BigInteger, ForeignKey("users.id"))
|
||||
|
||||
user = relationship("User", uselist=False, primaryjoin="User.id==Follow.user_id")
|
||||
target = relationship("User", lazy="joined", primaryjoin="User.id==Follow.target_id")
|
||||
target = relationship("User", primaryjoin="User.id==Follow.target_id")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
|
|
@ -168,7 +168,7 @@ class User(Base):
|
|||
|
||||
referred_by = Column(Integer, ForeignKey("users.id"))
|
||||
|
||||
referrals = relationship("User", lazy="joined")
|
||||
referrals = relationship("User")
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
|
||||
|
@ -623,7 +623,7 @@ class ViewerRelationship(Base):
|
|||
viewer_id = Column(Integer, ForeignKey('users.id'))
|
||||
last_view_utc = Column(Integer)
|
||||
|
||||
viewer = relationship("User", lazy="joined", primaryjoin="ViewerRelationship.viewer_id == User.id")
|
||||
viewer = relationship("User", primaryjoin="ViewerRelationship.viewer_id == User.id")
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@ class UserBlock(Base):
|
|||
user_id = Column(Integer, ForeignKey("users.id"))
|
||||
target_id = Column(Integer, ForeignKey("users.id"))
|
||||
|
||||
user = relationship("User", innerjoin=True, primaryjoin="User.id==UserBlock.user_id")
|
||||
target = relationship("User", innerjoin=True, primaryjoin="User.id==UserBlock.target_id")
|
||||
user = relationship("User", primaryjoin="User.id==UserBlock.user_id")
|
||||
target = relationship("User", primaryjoin="User.id==UserBlock.target_id")
|
||||
|
||||
def __repr__(self):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue