Esempio n. 1
0
class MatchResultModel(Model):
    __tablename__ = "match_result"

    id = fields.Integer(primary_key=True)
    match = fields.ForeignKey(MatchModel)
    side = fields.ForeignKey(SideModel)
    score = fields.Integer(default=0)
Esempio n. 2
0
class GameModel(Model):
    __tablename__ = "game"

    id = fields.Integer(primary_key=True)
    name = fields.String(max_length=64, unique=True)
    side_size_min = fields.Integer(default=1)
    side_size_max = fields.Integer(default=2)
    side_count_min = fields.Integer(default=2)
    side_count_max = fields.Integer(default=2)
Esempio n. 3
0
class SideModel(Model):
    __tablename__ = "side"

    id = fields.Integer(primary_key=True)
    name = fields.String(max_length=64)
    member_key = fields.String(unique=True, max_length=64)
    stats_key = fields.ForeignKey(StatsKeyModel)
Esempio n. 4
0
class VisitorModel(Model):
    __tablename__ = "visitor"

    id = fields.Integer(primary_key=True)
    name = fields.String(index=True, max_length=64)
    ip_addr = fields.String(index=True, max_length=15)
    location = fields.String(allow_null=True, max_length=64)
Esempio n. 5
0
class VisitModel(Model):
    __tablename__ = "visit"

    id = fields.Integer(primary_key=True)
    visited_on = fields.DateTime(default=datetime.datetime.utcnow)
    message = fields.String(max_length=64)
    visitor = fields.ForeignKey(VisitorModel)
Esempio n. 6
0
class MatchModel(Model):
    __tablename__ = "match"

    id = fields.Integer(primary_key=True)
    game = fields.ForeignKey(GameModel)
    created_at = fields.DateTime(default=datetime.datetime.utcnow)
    updated_at = fields.DateTime(default=datetime.datetime.utcnow)
Esempio n. 7
0
class StatsModel(Model):
    __tablename__ = "stats"

    id = fields.Integer(primary_key=True)
    stats_key = fields.ForeignKey(StatsKeyModel)
    game = fields.ForeignKey(GameModel)
    score_for = fields.Integer(default=0)
    score_against = fields.Integer(default=0)
    matches_played = fields.Integer(default=0)
    matches_won = fields.Integer(default=0)
    matches_lost = fields.Integer(default=0)
Esempio n. 8
0
class StatsKeyModel(Model):
    __tablename__ = "stats_key"

    id = fields.Integer(primary_key=True)
Esempio n. 9
0
class PlayerModel(Model):
    __tablename__ = "player"

    id = fields.Integer(primary_key=True)
    name = fields.String(max_length=64, unique=True)
    stats_key = fields.ForeignKey(StatsKeyModel)
Esempio n. 10
0
class SidePlayerModel(Model):
    __tablename__ = "side_player"

    id = fields.Integer(primary_key=True)
    side = fields.ForeignKey(SideModel)
    player = fields.ForeignKey(PlayerModel)