from peewee import *
from models import db


class DeviceInfo(Model):
    id = AutoField(primary_key=True)  # 主键，自增字段
    phone = CharField(max_length=50, null=False)  # varchar(50) NOT NULL
    device_model = CharField(max_length=50, null=False)  # varchar(50) NOT NULL
    system_version = CharField(max_length=50, default='Windows 10')  # varchar(50) DEFAULT 'Windows 10'
    app_version = CharField(max_length=50, default='5.5.5 x64')  # varchar(50) DEFAULT '5.5.5 x64'
    is_valid_session = IntegerField(default=0)  # int DEFAULT '0' COMMENT '0 无效， 1 有效'
    host = CharField(max_length=50, null=True)  # varchar(50) DEFAULT NULL COMMENT '服务器ip'

    class Meta:
        database = db  # 指定数据库
        table_name = 'device_info'  # 指定表名