transfer_competitions.ts 2.1 KB
/* jshint indent: 2 */
import * as moment from 'moment';

module.exports = function(sequelize:any, DataTypes:any) {
  return sequelize.define('transfer_competitions', {
    id: {
      type: DataTypes.STRING(50),
      allowNull: false,
      primaryKey: true
    },
    name: {
      type: DataTypes.STRING(50),
      allowNull: true
    },
    link: {
      type: DataTypes.STRING(255),
      allowNull: true
    },
    national_id: {
      type: DataTypes.BIGINT,
      allowNull: true
    },
    created_at: {
      type: DataTypes.BIGINT,
      allowNull: true,
      get(){
        return moment(this.getDataValue('created_at')).format('YYYY-MM-DD HH:mm:ss');
      }
    },
    updated_at: {
      type: DataTypes.BIGINT,
      allowNull: true,
      get(){
        return moment(this.getDataValue('updated_at')).format('YYYY-MM-DD HH:mm:ss');
      }
    },
    update_time: {
      type: DataTypes.DATE,
      allowNull: true,
      defaultValue: sequelize.literal('CURRENT_TIMESTAMP')
    },
    age: {
      type: DataTypes.STRING(30),
      allowNull: true
    },
    foreigners: {
      type: DataTypes.JSON,
      allowNull: true
    },
    league_level: {
      type: DataTypes.JSON,
      allowNull: true
    },
    market_value: {
      type: DataTypes.STRING(50),
      allowNull: true
    },
    most_valuable_player: {
      type: DataTypes.JSON,
      allowNull: true
    },
    number_of_teams: {
      type: DataTypes.STRING(50),
      allowNull: true
    },
    players: {
      type: DataTypes.STRING(20),
      allowNull: true
    },
    record_holding_champions: {
      type: DataTypes.JSON,
      allowNull: true
    },
    reigning_champion: {
      type: DataTypes.JSON,
      allowNull: true
    },
    total_market_value: {
      type: DataTypes.STRING(50),
      allowNull: true
    },
    uefa_coefficient: {
      type: DataTypes.JSON,
      allowNull: true
    },
    update_flag: {
      type: DataTypes.INTEGER(11),
      allowNull: true,
      defaultValue: '0'
    }, yiqiu_competition_id: {
      type: DataTypes.INTEGER(11),
      allowNull: true
    }
  }, {
    tableName: 'transfer_competitions'
  });
};