from django.db import models


class PubRecord(models.Model):  
    # 订阅数据
    topic = models.CharField("主题", max_length=64, default="")
    device_id = models.CharField("设备ID", max_length=32, default="")
    data = models.TextField("数据", default="")
    add_time = models.IntegerField("增加数据时间", default=0)
    is_forbidden = models.IntegerField("是否禁用", default=0)

    class Meta:
        using = "mqtt_record_db"
        db_table = "pub_record_table"


class PublishRecord(models.Model):
    # 发布数据
    topic= models.CharField("主题", max_length=64, default="")
    payload = models.TextField("消息", default="")
    add_time = models.IntegerField("增加数据时间", default=0)

    class Meta:
        using = "mqtt_record_db"
        db_table = "publish_record_table"
