You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.1 KiB
Python
45 lines
1.1 KiB
Python
import peewee
|
|
|
|
|
|
DATABASE = peewee.Proxy()
|
|
|
|
|
|
class BaseModel(peewee.Model):
|
|
class Meta:
|
|
database = DATABASE
|
|
|
|
|
|
class CoDUser(BaseModel):
|
|
user = peewee.TextField()
|
|
|
|
|
|
class CoDStandardStats(BaseModel):
|
|
ts = peewee.DateTimeField()
|
|
user = peewee.TextField()
|
|
kills = peewee.IntegerField()
|
|
deaths = peewee.IntegerField()
|
|
assists = peewee.IntegerField()
|
|
suicides = peewee.IntegerField()
|
|
total_games_played = peewee.IntegerField()
|
|
wins = peewee.IntegerField()
|
|
losses = peewee.IntegerField()
|
|
ties = peewee.IntegerField()
|
|
time_played_total = peewee.IntegerField()
|
|
average_life = peewee.FloatField()
|
|
career_score = peewee.IntegerField()
|
|
headshots = peewee.IntegerField()
|
|
total_shots = peewee.IntegerField()
|
|
hits = peewee.IntegerField()
|
|
misses = peewee.IntegerField()
|
|
|
|
class Meta:
|
|
primary_key = peewee.CompositeKey("ts", "user")
|
|
|
|
|
|
def create_tables():
|
|
DATABASE.create_tables([CoDUser, CoDStandardStats])
|
|
|
|
|
|
def create_hypertable():
|
|
DATABASE.execute_sql("SELECT create_hypertable('CoDStandardStats', 'ts');")
|