コード例 #1
0
class Item(Model):
    __tablename__ = 'items'
    item_id = Database.Column(Database.Integer,
                              primary_key=True,
                              nullable=False)
    item_name = Database.Column(Database.String(100), nullable=True)
    image_url = Database.Column(Database.String(200), nullable=False)
コード例 #2
0
class Hero(Model):
    __tablename__ = 'heroes'
    hero_id = Database.Column(Database.Integer,
                              primary_key=True,
                              nullable=False)
    hero_name = Database.Column(Database.String(100), nullable=True)
    portrait_url = Database.Column(Database.String(200), nullable=False)
コード例 #3
0
class History(Model):
    __tablename__ = 'histories'
    id = Database.Column(Database.Integer,
                         primary_key=True,
                         nullable=False,
                         autoincrement=True)
    last_match_id = Database.Column(Database.Integer, nullable=False)
コード例 #4
0
class Player(Model):
    __tablename__ = 'players'
    account_id = Database.Column(Database.BigInteger,
                                 primary_key=True,
                                 nullable=False)
    steam_id = Database.Column(Database.BigInteger, nullable=False, index=True)
    real_name = Database.Column(Database.String(200), nullable=True)
    persona_name = Database.Column(Database.String(100), nullable=True)
    avatar = Database.Column(Database.String(200), nullable=True)
    profile_url = Database.Column(Database.String(200), nullable=False)
コード例 #5
0
class MatchHero(Model):
    __tablename__ = 'match_heroes'
    id = Database.Column(Database.Integer,
                         primary_key=True,
                         nullable=False,
                         autoincrement=True)
    match_id = Database.Column(Database.Integer, nullable=False, index=True)
    account_id = Database.Column(Database.BigInteger,
                                 nullable=False,
                                 index=True)
    player_win = Database.Column(Database.Boolean, nullable=False)
    hero_id = Database.Column(Database.Integer, nullable=False)
コード例 #6
0
class MatchHeroSummary(Model):
    __tablename__ = 'match_hero_summaries'
    account_id = Database.Column(Database.BigInteger,
                                 primary_key=True,
                                 nullable=False)
    hero_id = Database.Column(Database.Integer,
                              Database.ForeignKey('heroes.hero_id'),
                              primary_key=True,
                              nullable=False)
    player_win = Database.Column(Database.Integer, nullable=False)
    matches = Database.Column(Database.Integer, nullable=False)
    win_rate = Database.Column(Database.Numeric(precision=5, scale=2),
                               nullable=False)
    hero = Database.relationship(Hero)
コード例 #7
0
class MatchItemSummary(Model):
    __tablename__ = 'match_item_summaries'
    account_id = Database.Column(Database.BigInteger,
                                 primary_key=True,
                                 nullable=False)
    item_id = Database.Column(Database.Integer,
                              Database.ForeignKey('items.item_id'),
                              primary_key=True,
                              nullable=False)
    player_win = Database.Column(Database.Integer, nullable=False)
    matches = Database.Column(Database.Integer, nullable=False)
    win_rate = Database.Column(Database.Numeric(precision=5, scale=2),
                               nullable=False)
    item = Database.relationship(Item)
コード例 #8
0
def initialise_database():
    Database.create_all()