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


module.exports = function(sequelize:any, DataTypes:any) {
    return sequelize.define('transfer_players_injury_transfer', {
      id: {
        type: DataTypes.BIGINT,
        allowNull: false,
        primaryKey: true,
        autoIncrement: true
      },
      player_id: {
        type: DataTypes.BIGINT,
        allowNull: true
      },
      competition_id: {
        type: DataTypes.STRING(50),
        allowNull: true
      },
      position: {
        type: DataTypes.STRING(100),
        allowNull: true
      },
      name: {
        type: DataTypes.STRING(50),
        allowNull: true
      },
      photo: {
        type: DataTypes.STRING(255),
        allowNull: true
      },
      age:{
        type: DataTypes.INTEGER(11),
        allowNull: true
      },
      club_id:{
        type: DataTypes.BIGINT,
        allowNull: true
      },
      club_name: {
        type: DataTypes.STRING(50),
        allowNull: true
      },
      club_logo: {
        type: DataTypes.STRING(255),
        allowNull: true
      },
      nation:{
        type: DataTypes.JSON,
        allowNull: true
      },
      injury: {
        type: DataTypes.STRING(50),
        allowNull: true
      },
      since: {
        type: DataTypes.STRING(50),
        allowNull: true
      },
      until: {
        type: DataTypes.STRING(50),
        allowNull: true
      },
      market_value: {
        type: DataTypes.STRING(50),
        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')
      }
    }, {
      tableName: 'transfer_players_injury_transfer'
    });
  };