You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.5 KiB

import flask_sqlalchemy
db = flask_sqlalchemy.SQLAlchemy()
class Video(db.Model):
__tablename__ = 'videos'
id = db.Column(db.Integer, primary_key=True)
broadcast_type = db.Column(db.String)
title = db.Column(db.String)
description = db.Column(db.String)
game = db.Column(db.String)
length = db.Column(db.Integer)
thumbnail_small = db.Column(db.String)
thumbnail_medium = db.Column(db.String)
thumbnail_large = db.Column(db.String)
created_at = db.Column(db.DateTime)
updated_at = db.Column(db.DateTime)
recorded_at = db.Column(db.DateTime)
published_at = db.Column(db.DateTime)
associations = db.relationship('Association')
class Comment(db.Model):
__tablename__ = 'comments'
id = db.Column(db.String, primary_key=True)
commenter_id = db.Column(db.Integer)
commenter_name = db.Column(db.String)
commenter_display_name = db.Column(db.String)
commenter_logo = db.Column(db.String)
source = db.Column(db.String)
message_body = db.Column(db.String)
message_user_color = db.Column(db.String)
message_user_badges = db.Column(db.String)
created_at = db.Column(db.DateTime)
updated_at = db.Column(db.DateTime)
class Association(db.Model):
__tablename__ = 'association'
video_id = db.Column(db.Integer, db.ForeignKey('videos.id'), primary_key=True)
comment_id = db.Column(db.String, db.ForeignKey('comments.id'), primary_key=True)
offset = db.Column(db.Float)
comment = db.relationship('Comment')