#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
    demeter database
    name:device_gateway.py
    author:rabin
"""
from .__load__ import *

class Device_gateway(Model):
	__table__ = 'device_gateway'
	__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必须是数字')
	pic = Fields(type='varchar(255)', comment='设备分布图纸')
	camera = Fields(type='varchar(500)', comment='摄像头实时流地址')
	stat = Fields(type='boolean', default='False', comment='是否显示趋势图')
	state = Fields(type='boolean', default='True', comment='数据存在状态')
	cdate = Fields(type='int', default='time', comment='创建时间')
	product_id = Fields(type='int', comment='产品id')
	server_id = Fields(type='int', comment='服务id')
	#ALTER TABLE demeter_device_gateway ADD product_id int; 
	#ALTER TABLE demeter_device_gateway ADD server_id int; 