40 lines
1.0 KiB
Lua
40 lines
1.0 KiB
Lua
|
|
local skynet = require "skynet"
|
|||
|
|
local oo = require "Class"
|
|||
|
|
local tableDef = require "TableDef"
|
|||
|
|
local TablePlayer = oo.class(tableDef)
|
|||
|
|
|
|||
|
|
--表名
|
|||
|
|
TablePlayer.TableName = "player"
|
|||
|
|
|
|||
|
|
--主键
|
|||
|
|
TablePlayer.PrimaryKey =
|
|||
|
|
{
|
|||
|
|
{ fieldsName = "UserID" , fieldsStartPosition = 100000 }
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
--索引
|
|||
|
|
TablePlayer.Index =
|
|||
|
|
{
|
|||
|
|
{ indexFields = "UserID" , IndexName = "UserIDIndex" }
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
--表字段
|
|||
|
|
TablePlayer.Fields =
|
|||
|
|
{
|
|||
|
|
--[[
|
|||
|
|
下面一条数据代表一个字段
|
|||
|
|
参数字段信息:
|
|||
|
|
参数1:字段名称 ,
|
|||
|
|
参数2:字段具体值 ,可能是数字、字符串和表
|
|||
|
|
参数3:数据库类型
|
|||
|
|
参数4:字段特性
|
|||
|
|
参数5:字段备注信息
|
|||
|
|
]]
|
|||
|
|
|
|||
|
|
{"UserID", 0 , "int(10)" , "not null" , "数据库ID" } ,
|
|||
|
|
{"BasicInfo", {} , "json" , "not null" ,"基础信息包括玩家的IP、登陆时间等" } ,
|
|||
|
|
{"GameData", {} , "json" , "not null" ,"游戏数据" } ,
|
|||
|
|
{"RefreshTime", {} , "timestamp" , "null default current_timestamp on update current_timestamp" ,"用户数据刷新时间" } ,
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return TablePlayer
|