transfer_players.ts 2.8 KB
/* jshint indent: 2 */
import * as moment from 'moment';

module.exports = function(sequelize:any, DataTypes:any) {
  return sequelize.define('transfer_players', {
    id: {
      type:DataTypes.BIGINT,
      allowNull:false,
      primaryKey: true
    },
    player_id: {
      type: DataTypes.BIGINT,
      allowNull: false,
      primaryKey: true
    },
    team_id: {
      type: DataTypes.BIGINT,
      allowNull: false,
      primaryKey: true
    },
    competition_id: {
      type: DataTypes.STRING(50),
      allowNull: false,
      primaryKey: true
    },
    shirt_number: {
      type: DataTypes.BIGINT,
      allowNull: true
    },
    name: {
      type: DataTypes.STRING(100),
      allowNull: true
    },
    position_id: {
      type: DataTypes.BIGINT,
      allowNull: true
    },
    link: {
      type: DataTypes.STRING(255),
      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_flag: {
      type: DataTypes.INTEGER(11),
      allowNull: false,
      defaultValue: '0'
    },
    age: {
      type: DataTypes.INTEGER(11),
      allowNull: true
    },
    birth_date: {
      type: DataTypes.STRING(30),
      allowNull: true
    },
    birth_place: {
      type: DataTypes.STRING(100),
      allowNull: true
    },
    contract_expires: {
      type: DataTypes.STRING(50),
      allowNull: true
    },
    current_club_id: {
      type: DataTypes.BIGINT,
      allowNull: true
    },
    current_club_name: {
      type: DataTypes.STRING(100),
      allowNull: true
    },
    current_market_value: {
      type: DataTypes.STRING(50),
      allowNull: true
    },
    foot: {
      type: DataTypes.STRING(20),
      allowNull: true
    },
    height: {
      type: DataTypes.STRING(20),
      allowNull: true
    },
    highest_market_value: {
      type: DataTypes.STRING(100),
      allowNull: true
    },
    join_date: {
      type: DataTypes.STRING(30),
      allowNull: true
    },
    last_update: {
      type: DataTypes.STRING(30),
      allowNull: true
    },
    main_position: {
      type: DataTypes.STRING(50),
      allowNull: true
    },
    national_id: {
      type: DataTypes.BIGINT,
      allowNull: true
    },
    national_name: {
      type: DataTypes.STRING(50),
      allowNull: true
    },
    other_position: {
      type: DataTypes.STRING(100),
      allowNull: true
    },
    player_agent: {
      type: DataTypes.STRING(50),
      allowNull: true
    },
    position: {
      type: DataTypes.STRING(50),
      allowNull: true
    }
  }, {
    tableName: 'transfer_players'
  });
};