12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- module.exports = app => {
- const { STRING, INTEGER, DATE } = app.Sequelize;
- const User = app.model.define('users', {
- id: {
- type: INTEGER,
- primaryKey: true,
- autoIncrement: true,
- notNull: true,
- notEmpty: true,
- comment: '用户ID',
- },
- wallet: {
- type: STRING(64),
- notNull: true,
- notEmpty: true,
- comment: '钱包地址',
- },
- level: {
- type: INTEGER,
- notNull: true,
- notEmpty: true,
- defaultValue: 0,
- comment: '用户等级',
- },
- hash_rate: {
- type: INTEGER,
- notNull: true,
- notEmpty: true,
- defaultValue: 0,
- comment: '用户算力',
- },
- pid: {
- type: INTEGER,
- notNull: true,
- notEmpty: true,
- comment: '父级ID',
- },
- path: {
- type: STRING,
- notNull: true,
- notEmpty: true,
- comment: '用户邀请路径',
- },
- created_at: DATE,
- updated_at: DATE,
- }, {
- indexes: [
- {
- name: 'I_wallet',
- fields: [ 'wallet' ],
- using: 'BTREE',
- },
- {
- name: 'I_level',
- fields: [ 'level' ],
- using: 'BTREE',
- },
- {
- name: 'I_pid',
- fields: [ 'pid' ],
- using: 'BTREE',
- },
- {
- name: 'I_path',
- fields: [ 'path' ],
- using: 'BTREE',
- },
- ],
- });
- User.sync();
- return User;
- };
|