#!/usr/bin/env python # -*- coding: utf-8 -*- """ demeter database name:device_info.py author:rabin """ from __load__ import * class Device_info(Model): __table__ = 'device_info' __comment__ = '设备管理' id = Fields(type='uuid', primaryKey=True, comment='设备ID', uuid='farm_id') farm_id = Fields(type='int', default='setting.farm', comment='园区ID', match='not') name = Fields(type='varchar(50)', comment='设备名') hardware_id = Fields(type='bigint', comment='硬件id', match='number|硬件id必须是数字') hardware_type = Fields(type='int', comment='硬件类型') gateway_id = Fields(type='uuid', comment='网关id') type_id = Fields(type='int', comment='设备类型') value = Fields(type='varchar(1000)', comment='设备传过来的值') exp = Fields(type='varchar(500)', comment='表达式') max = Fields(type='float', comment='最大上限', match='number|最大上限必须是数字') min = Fields(type='float', comment='最小下限', match='number|最小下限必须是数字') cxnum = Fields(type='int', comment='超限次数') cxtype = Fields(type='int', comment='超限类型,1为超过上限,2为超过下限') cxdate = Fields(type='int', comment='首次超限时间') status = Fields(type='boolean', default='False', comment='设备连接状态') state = Fields(type='boolean', default='True', comment='数据存在状态') cdate = Fields(type='int', default='time', comment='创建时间') udate = Fields(type='int', default='time', comment='接入时间') inorder = Fields(type='int', default='0', comment='排序', match='number|排序必须是数字') oper = Fields(type='boolean', default='False', comment='操作类型') operdate = Fields(type='int', comment='操作时间') ##ALTER TABLE demeter_device_info ADD exp varchar(500); #ALTER TABLE demeter_device_info ADD inorder int default 100; #ALTER TABLE demeter_device_info ADD oper boolean; #ALTER TABLE demeter_device_info ADD operdate int; #ALTER TABLE demeter_device_info DROP inorder;