# -*- coding: utf-8 -*-
"""
    demeter database
    name:msg.py
    author:rabin
    mqtt里的key:msg/type_key/farm_id/uid,value

"""
from .__load__ import *

class Msg(Model):
	__table__ = 'msg'
	__comment__ = '消息表'
	id = Fields(type='uuid', primaryKey=True, comment='消息ID', uuid='farm_id')
	farm_id = Fields(type='int', default='setting.farm', comment='园区ID')
	device_id = Fields(type='uuid', comment='设备ID')
	uid = Fields(type='uuid', comment='用户ID')
	type_id = Fields(type='int', comment='分类ID')
	link = Fields(type='varchar(255)', comment='消息链接')
	content = Fields(type='text', comment='消息内容')
	push = Fields(type='varchar(50)', comment='推送')
	status = Fields(type='boolean', default='False', comment='是否已读')
	state = Fields(type='boolean', default='True', comment='数据存在状态')
	cdate = Fields(type='int', default='time', comment='创建时间')