1 | ;
|
2 |
|
3 | var dbm;
|
4 | var type;
|
5 | var seed;
|
6 |
|
7 | /**
|
8 | * We receive the dbmigrate dependency from dbmigrate initially.
|
9 | * This enables us to not have to rely on NODE_PATH.
|
10 | */
|
11 | exports.setup = function(options, seedLink) {
|
12 | dbm = options.dbmigrate;
|
13 | type = dbm.dataType;
|
14 | seed = seedLink;
|
15 | };
|
16 |
|
17 | exports.up = function(db) {
|
18 | return db.createTable('m_player', {
|
19 | id: { type: 'int', primaryKey: true, autoIncrement: true}, //主键,本服内用户唯一编号
|
20 | domain: {type: 'string', length: 50, defaultValue: 'official'}, //联合外键
|
21 | uuid: {type: 'string', length: 50}, //联合外键
|
22 | name: {type: 'string', length: 200}, //姓名
|
23 | password: {type: 'string', length: 50}, //密码
|
24 | activity: {type: 'string', length: 500}, //活动
|
25 | dailyactivity: {type: 'string', length: 500}, //活动
|
26 | Tollgate: {type: 'string', length: 500}, //副本信息
|
27 | login: {type: 'string', length: 200}, //副本随机事件
|
28 | diamond: {type: 'int', defaultValue: 0}, //钻石
|
29 | status: {type: 'int', defaultValue: 0}, //复合状态,表示各类开启的特殊权限(不同于消息状态)
|
30 | refreshTime: {type: 'string', length: 50}, //刷新时间,用于控制各类随时间增长的收益
|
31 | createdAt: {type: 'datetime'}, //创建时间
|
32 | updatedAt: {type: 'datetime'}, //更新时间
|
33 | score: {type: 'int', defaultValue: 0},
|
34 | setting: {type: 'string', length: 500},
|
35 | hisGateNo: {type: 'int', defaultValue: 1},
|
36 | role: {type: 'int', defaultValue: 1001},
|
37 | info: {type: 'string', length: 2000},
|
38 | pet: {type: 'string', length: 500},
|
39 | txinfo: {type: 'string', length: 500},
|
40 | txBule: {type: 'string', length: 500},
|
41 | item: {type: 'string', length: 500},
|
42 | vip: {type: 'string', length: 500},
|
43 | friend: {type: 'string', length: 500},
|
44 | task: {type: 'string', length: 500}, //任务
|
45 | txFriend: {type: 'string', length: 500},
|
46 | execInfo: { type: 'string', length: 500}, //行为限制信息存储字段
|
47 | pocket: { type: 'string', length: 500}, //包裹序列化串存储字段
|
48 | shopInfo: { type: 'string', length: 2000}, //商品属性列表、已购买纪录的缓存
|
49 | aid: { type: 'int', defaultValue: 0}, //联盟ID
|
50 | invite: { type: 'string', length: 255}, //申请、邀请记录
|
51 | }).then(
|
52 | function(result) {
|
53 | db.addIndex('m_player', 'domanId', ['domain', 'uuid'], true, (err, result)=>{});
|
54 | },
|
55 | function(err) {
|
56 | }
|
57 | );
|
58 | };
|
59 |
|
60 | exports.down = function(db) {
|
61 | return db.dropTable('m_player').then(
|
62 | function(result) {
|
63 | },
|
64 | function(err) {
|
65 | }
|
66 | );
|
67 | };
|
68 |
|
69 | exports._meta = {
|
70 | "version": 1
|
71 | };
|
72 |
|
73 | // {
|
74 | // CHAR: 'char',
|
75 | // STRING: 'string',
|
76 | // TEXT: 'text',
|
77 | // SMALLINT: 'smallint',
|
78 | // BIGINT: 'bigint',
|
79 | // INTEGER: 'int',
|
80 | // SMALL_INTEGER: 'smallint',
|
81 | // BIG_INTEGER: 'bigint',
|
82 | // REAL: 'real',
|
83 | // DATE: 'date',
|
84 | // DATE_TIME: 'datetime',
|
85 | // TIME: 'time',
|
86 | // BLOB: 'blob',
|
87 | // TIMESTAMP: 'timestamp',
|
88 | // BINARY: 'binary',
|
89 | // BOOLEAN: 'boolean',
|
90 | // DECIMAL: 'decimal'
|
91 | // };
|
92 |
|
93 | // type - the column data type. Supported types can be found in db-migrate-shared/data_type.js
|
94 | // length - the column data length, where supported
|
95 | // primaryKey - true to set the column as a primary key. Compound primary keys are supported by setting the primaryKey option to true on multiple columns
|
96 | // autoIncrement - true to mark the column as auto incrementing
|
97 | // notNull - true to mark the column as non-nullable, omit it archive database default behavior and false to mark explicitly as nullable
|
98 | // unique - true to add unique constraint to the column
|
99 | // defaultValue - set the column default value. To set an expression (eg a function call) as the default value use this syntax: defaultValue: new String('uuid_generate_v4()')
|
100 | // foreignKey - set a foreign key to the column |
\ | No newline at end of file |