Advertisement
Guest User

p_msisdn

a guest
Jul 19th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module.exports = (sequelize, Sequelize) => {
  2.     const Msisdn = sequelize.define(
  3.         'p_msisdn', {
  4.             id: {
  5.                 type: Sequelize.INTEGER,
  6.                 primaryKey: true,
  7.                 autoIncrement: true,
  8.                 allowNull: false
  9.             },
  10.             group_id: {
  11.                 type: Sequelize.INTEGER,
  12.             },
  13.             msisdn: {
  14.                 type: Sequelize.INTEGER,
  15.                 validate:{
  16.                     isNumeric:true
  17.                 }
  18.             },
  19.             created_at: {
  20.                 type: 'TIMESTAMP',
  21.                 defaultValue: Sequelize.literal('CURRENT_TIMESTAMP')
  22.             }
  23.         },
  24.         {
  25.             timestamps: false,
  26.             underscored: false,
  27.             freezeTableName: true,
  28.             tableName:'p_msisdn'
  29.         }
  30.     );
  31.     Msisdn.associate = (models) => {
  32.         Msisdn.belongsTo(models.Group,{foreignKey:'group_id',as:'group'});
  33.     }
  34.     return Msisdn;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement