const system=require("../../../system");
const settings=require("../../../../config/settings");
const uiconfig=system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
  return db.define("users", {
    phone_no: DataTypes.STRING(16),
    com_type: DataTypes.INTEGER,
    com_name: DataTypes.STRING(1000),
    user_type: DataTypes.STRING(50),
    user_identity: DataTypes.STRING(50),
    user_name: DataTypes.STRING(1000),
    id_card: DataTypes.STRING(20),
    user_photo: DataTypes.STRING(255),
    cert_no: DataTypes.STRING(50),
    user_post: DataTypes.STRING(50),
    status_type: DataTypes.INTEGER,
    status_name: DataTypes.STRING(16),
    legal_name: DataTypes.STRING(50),
    bus_term: DataTypes.STRING(50),
    user_address: DataTypes.STRING(1000),
    user_path: DataTypes.STRING(255),
    com_path: DataTypes.STRING(255),
    card_path: DataTypes.STRING(2000),
    cert_path: DataTypes.STRING(2000),
    reg_time: DataTypes.DATE,
    cattes_time: DataTypes.DATE,
    uattes_time: DataTypes.DATE,
    memo1_text: DataTypes.STRING,
    memo2_text: DataTypes.STRING,
    is_real: {
      type:DataTypes.INTEGER,
      defaultValue: 0,
    },
    is_com: {
      type:DataTypes.INTEGER,
      defaultValue: 0,
    },
  },{
     paranoid: true,//假的删除
     underscored: true,
     version: false,
     freezeTableName: true,
     //freezeTableName: true,
     // define the table's name
      tableName: 'user_info',
     validate: {

     },
     indexes:[
       // Create a unique index on email
        //  {
        //    unique: true,
        //    fields: ['email']
        //  },
         //
        //  // Creates a gin index on data with the jsonb_path_ops operator
        //  {
        //    fields: ['data'],
        //    using: 'gin',
        //    operator: 'jsonb_path_ops'
        //  },
         //
        //  // By default index name will be [table]_[fields]
        //  // Creates a multi column partial index
        //  {
        //    name: 'public_by_author',
        //    fields: ['author', 'status'],
        //    where: {
        //      status: 'public'
        //    }
        //  },
         //
        //  // A BTREE index with a ordered field
        //  {
        //    name: 'title_index',
        //    method: 'BTREE',
        //    fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
        //  }
     ]
  });
}
