/*=============================================================================================
author:ZhaoJun
version:1.2
email:2732810281@qq.com
=============================================================================================*/


//严格模式
/*-------------------------------------------------------------------------------------------*/	
'use strict';
/*-------------------------------------------------------------------------------------------*/	


//生成表
/*-------------------------------------------------------------------------------------------*/	
class super_db
{
	static su_ad()
	{
		let table=
		{
			id:
			{
				private:{type:"int",length:"11",notnull:"NOT NULL",auto:"true"},
				extends:{descript:"广告主键",escape:true}
			},
			click_url:
			{
				private:{type:"varchar",length:"256",notnull:""},
				extends:{descript:"广告点击跳转地址",escape:true}
			},
			title:
			{
				private:{type:"varchar",length:"20",notnull:""},
				extends:{descript:"标题",escape:true}
			},
			image:
			{
				private:{type:"varchar",length:"256",notnull:""},
				extends:{descript:"广告图片",escape:true}
			},
		}

		table.$comment="广告"
		table.$index=["PRIMARY KEY (`id`)"]
		table.$type="mysql"
		table.$as="main"
		table.$meta="utf8"
		table.$eng="InnoDB"
		return table;
	}

	static su_article()
	{
		let table=
		{
			id:
			{
				private:{type:"int",length:"11",notnull:"NOT NULL",auto:"true"},
				extends:{descript:"文章主键",escape:true}
			},
			userid:
			{
				private:{type:"int",length:"11",notnull:""},
				extends:{descript:"用户id",escape:true}
			},
			title:
			{
				private:{type:"varchar",length:"50",notnull:""},
				extends:{descript:"文章标题",escape:true}
			},
			content:
			{
				private:{type:"text",notnull:""},
				extends:{descript:"文章内容",escape:true}
			},
			time:
			{
				private:{type:"int",length:"11",notnull:""},
				extends:{descript:"文章发表时间",escape:true}
			},
			image:
			{
				private:{type:"varchar",length:"256",notnull:""},
				extends:{descript:"文章封面图片",escape:true}
			},
		}

		table.$comment="文章"
		table.$index=["PRIMARY KEY (`id`)"]
		table.$type="mysql"
		table.$as="main"
		table.$meta="utf8"
		table.$eng="InnoDB"
		return table;
	}

	static su_article_reply()
	{
		let table=
		{
			id:
			{
				private:{type:"int",length:"11",notnull:"NOT NULL",auto:"true"},
				extends:{descript:"文章回复主键",escape:true}
			},
			articleid:
			{
				private:{type:"int",length:"11",notnull:""},
				extends:{descript:"文章id",escape:true}
			},
			userid:
			{
				private:{type:"int",length:"11",notnull:""},
				extends:{descript:"用户id",escape:true}
			},
			content:
			{
				private:{type:"text",notnull:""},
				extends:{descript:"文章回复内容",escape:true}
			},
			reply:
			{
				private:{type:"text",notnull:""},
				extends:{descript:"文章回复的回复",escape:true}
			},
			time:
			{
				private:{type:"int",length:"11",notnull:""},
				extends:{descript:"文章回复时间",escape:true}
			},
			image:
			{
				private:{type:"varchar",length:"256",notnull:""},
				extends:{descript:"回复图片",escape:true}
			},
		}

		table.$comment="文章回复"
		table.$index=["PRIMARY KEY (`id`)"]
		table.$type="mysql"
		table.$as="main"
		table.$meta="utf8"
		table.$eng="InnoDB"
		return table;
	}

	static su_dev()
	{
		let table=
		{
			id:
			{
				private:{type:"int",length:"11",notnull:"NOT NULL",auto:"true"},
				extends:{descript:"设备主键",escape:true}
			},
			userid:
			{
				private:{type:"int",length:"11",notnull:""},
				extends:{descript:"用户id",escape:true}
			},
			devid:
			{
				private:{type:"int",length:"11",notnull:""},
				extends:{descript:"设备id",escape:true}
			},
			name:
			{
				private:{type:"varchar",length:"50",notnull:"",default:""},
				extends:{descript:"设备名",escape:true}
			},
			image:
			{
				private:{type:"varchar",length:"50",notnull:"",default:""},
				extends:{descript:"设备头像",escape:true}
			},
			pass:
			{
				private:{type:"varchar",length:"50",notnull:"",default:""},
				extends:{descript:"设备密码",escape:true}
			},
			time:
			{
				private:{type:"int",length:"11",notnull:"",default:"0"},
				extends:{descript:"注册时间",escape:true}
			},
			role:
			{
				private:{type:"varchar",length:"256",notnull:"",default:"1"},
				extends:{descript:"用户角色",escape:true}
			},
		}

		table.$comment="智能设备"
		table.$index=["PRIMARY KEY (`id`)","UNIQUE KEY `devid` (`devid`)"]
		table.$type="mysql"
		table.$as="main"
		table.$meta="utf8"
		table.$eng="InnoDB"
		return table;
	}

	static su_user()
	{
		let table=
		{
			id:
			{
				private:{type:"int",length:"11",notnull:"NOT NULL",auto:"true"},
				extends:{descript:"用户主键",escape:true}
			},
			tel:
			{
				private:{type:"varchar",length:"22",notnull:""},
				extends:{descript:"用户电话",escape:true}
			},
			name:
			{
				private:{type:"varchar",length:"50",notnull:"",default:""},
				extends:{descript:"用户名",escape:true}
			},
			image:
			{
				private:{type:"varchar",length:"50",notnull:"",default:""},
				extends:{descript:"用户头像",escape:true}
			},
			pass:
			{
				private:{type:"varchar",length:"50",notnull:"",default:""},
				extends:{descript:"用户密码sha1加密",escape:true}
			},
			time:
			{
				private:{type:"int",length:"11",notnull:"",default:"0"},
				extends:{descript:"注册时间",escape:true}
			},
			role:
			{
				private:{type:"varchar",length:"256",notnull:"",default:"1"},
				extends:{descript:"用户角色，0代表禁用,1代表普通用户,2代表社区维护者,3代表社区贡献者\n				,4代表社区代码贡献者,5技术研究员,6荣誉会员,7代表管理员,8代表超级管理",escape:true}
			},
			openid:
			{
				private:{type:"varchar",length:"256",notnull:"",default:"1"},
				extends:{descript:"用户openid",escape:true}
			},
		}

		table.$comment="用户表"
		table.$index=["PRIMARY KEY (`id`)","UNIQUE KEY `tel` (`tel`)"]
		table.$type="mysql"
		table.$as="main"
		table.$meta="utf8"
		table.$eng="InnoDB"
		return table;
	}


}
/*-------------------------------------------------------------------------------------------*/

module.exports=super_db; 