Exemple #1
0
class Redditor(db.Model):
    __tablename__ = 'redditors'
    __bind_key__ = 'memedata'

    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(20), nullable=False, unique=True)
    memes = db.relationship('RedditMeme', backref='redditor', lazy=True)
    scores = db.relationship('RedditScore', backref='redditor', lazy=True)
Exemple #2
0
class CommentVote(db.Model):
    __tablename__ = 'comment_vote'
    __bind_key__ = 'sitedata'
    id = db.Column(db.Integer, primary_key=True, server_default=db.FetchedValue())
    userId = db.Column(db.ForeignKey('users.id'), nullable=False)
    commentId = db.Column(db.ForeignKey('comments.id'), nullable=False)
    value = db.Column(db.Integer, nullable=False)
    createdAt = db.Column(db.DateTime, nullable=False)
    comment = db.relationship('Comment', primaryjoin='CommentVote.commentId == Comment.id', backref='comment_votes')
    user = db.relationship('User', primaryjoin='CommentVote.userId == User.id', backref='comment_votes')
Exemple #3
0
class MemeVote(db.Model):
    __tablename__ = 'meme_vote'
    __bind_key__ = 'sitedata'
    id = db.Column(db.Integer, primary_key=True, server_default=db.FetchedValue())
    userId = db.Column(db.ForeignKey('users.id'), nullable=False)
    memeId = db.Column(db.ForeignKey('memes.id'), nullable=False)
    value = db.Column(db.Integer, nullable=False)
    createdAt = db.Column(db.DateTime, nullable=False)
    meme = db.relationship('Meme', primaryjoin='MemeVote.memeId == Meme.id', backref='meme_votes')
    user = db.relationship('User', primaryjoin='MemeVote.userId == User.id', backref='meme_votes')
Exemple #4
0
class Comment(db.Model):
    __tablename__ = 'comments'
    __bind_key__ = 'sitedata'
    id = db.Column(db.Integer, primary_key=True, server_default=db.FetchedValue())
    text = db.Column(db.String, nullable=False)
    userId = db.Column(db.ForeignKey('users.id'), nullable=False)
    memeId = db.Column(db.ForeignKey('memes.id'), nullable=False)
    createdAt = db.Column(db.DateTime, nullable=False)
    meme = db.relationship('Meme', primaryjoin='Comment.memeId == Meme.id', backref='comments')
    user = db.relationship('User', primaryjoin='Comment.userId == User.id', backref='comments')