from peewee import *

from models import db


class Weex15(Model):
    id = IntegerField(primary_key=True)
    open = FloatField(null=True)
    high = FloatField(null=True)
    low = FloatField(null=True)
    close = FloatField(null=True)

    class Meta:
        database = db
        table_name = 'weex_15'


class Weex1(Model):
    id = IntegerField(primary_key=True)
    open = FloatField(null=True)
    high = FloatField(null=True)
    low = FloatField(null=True)
    close = FloatField(null=True)

    class Meta:
        database = db
        table_name = 'weex_1'


class Weex1Hour(Model):
    id = IntegerField(primary_key=True)
    open = FloatField(null=True)
    high = FloatField(null=True)
    low = FloatField(null=True)
    close = FloatField(null=True)

    class Meta:
        database = db
        table_name = 'weex_1_hour'

class Weex30(Model):
    id = IntegerField(primary_key=True)
    open = FloatField(null=True)
    high = FloatField(null=True)
    low = FloatField(null=True)
    close = FloatField(null=True)

    class Meta:
        database = db
        table_name = 'weex_30'

class Weex30Copy(Model):
    id = IntegerField(primary_key=True)
    open = FloatField(null=True)
    high = FloatField(null=True)
    low = FloatField(null=True)
    close = FloatField(null=True)

    class Meta:
        database = db
        table_name = 'weex_30_copy1'


# 连接到数据库
db.connect()

# 创建表（如果表不存在）
db.create_tables([Weex15])
db.create_tables([Weex1])
