45 lines
1.4 KiB
Python
45 lines
1.4 KiB
Python
|
# -*- coding:utf8 -*-
|
||
|
from peewee import *
|
||
|
db = SqliteDatabase('model.db')
|
||
|
|
||
|
class BaseModel(Model):
|
||
|
class Meta:
|
||
|
database = db
|
||
|
|
||
|
class Model(BaseModel):
|
||
|
path = CharField(primary_key=True)
|
||
|
position = CharField(null = False)
|
||
|
type = CharField(null = False)
|
||
|
frame = IntegerField(null = False)
|
||
|
create_time = DateTimeField(null=False)
|
||
|
class Meta:
|
||
|
order_by = ('type',)
|
||
|
db_table = 'model'
|
||
|
|
||
|
class Battle(BaseModel):
|
||
|
id = PrimaryKeyField()
|
||
|
challenger_path = CharField(null = False)
|
||
|
challenger_position = CharField(null = False)
|
||
|
status = IntegerField(null = False)
|
||
|
challenger_wp = DecimalField(null=True)
|
||
|
challenger_adp = DecimalField(null=True)
|
||
|
class Meta:
|
||
|
order_by = ('id',)
|
||
|
db_table = 'battle'
|
||
|
|
||
|
class Baseline(BaseModel):
|
||
|
id = PrimaryKeyField()
|
||
|
landlord_path = ForeignKeyField(Model, to_field='path',related_name = "model")
|
||
|
landlord_up_path = ForeignKeyField(Model, to_field='path',related_name = "model")
|
||
|
landlord_front_path = ForeignKeyField(Model, to_field='path',related_name = "model")
|
||
|
landlord_down_path = ForeignKeyField(Model, to_field='path',related_name = "model")
|
||
|
rank = IntegerField(null = False)
|
||
|
landlord_wp = DecimalField(null=False)
|
||
|
farmer_wp = DecimalField(null=False)
|
||
|
landlord_adp = DecimalField(null=False)
|
||
|
farmer_adp = DecimalField(null=False)
|
||
|
create_time = DateTimeField(null=False)
|
||
|
class Meta:
|
||
|
order_by = ('id',)
|
||
|
db_table = 'baseline'
|