transfer_teams.ts 2.0 KB
/* jshint indent: 2 */
import * as moment from 'moment';

module.exports = function(sequelize:any, DataTypes:any) {
  return sequelize.define('transfer_teams', {
    id: {
      type: DataTypes.BIGINT,
      allowNull: false,
      primaryKey: true,
      autoIncrement: true
    },
    team_id: {
      type: DataTypes.BIGINT,
      allowNull: false
    },
    name: {
      type: DataTypes.STRING(100),
      allowNull: true
    },
    link: {
      type: DataTypes.STRING(255),
      allowNull: true
    },
    competition_id: {
      type: DataTypes.STRING(50),
      allowNull: false
    },
    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');
      }
    },
    ms_soccer_team_id: {
      type: DataTypes.INTEGER(11),
      allowNull: true
    },
    update_time: {
      type: DataTypes.DATE,
      allowNull: true,
      defaultValue: sequelize.literal('CURRENT_TIMESTAMP')
    },
    average_age: {
      type: DataTypes.STRING(30),
      allowNull: true
    },
    current_transfer_record: {
      type: DataTypes.STRING(30),
      allowNull: true
    },
    data_erfolge: {
      type: DataTypes.JSON,
      allowNull: true
    },
    foreigners: {
      type: DataTypes.JSON,
      allowNull: true
    },
    national_team_players: {
      type: DataTypes.STRING(20),
      allowNull: true
    },
    squad_size: {
      type: DataTypes.STRING(20),
      allowNull: true
    },
    stadium: {
      type: DataTypes.JSON,
      allowNull: true
    },
    total_market_value: {
      type: DataTypes.STRING(50),
      allowNull: true
    },
    update_flag: {
      type: DataTypes.INTEGER(11),
      allowNull: true,
      defaultValue: '0'
    }
  }, {
    tableName: 'transfer_teams'
  });
};