title: sequelize beforeCreate hook is not executing
body: <p>I wrote a BeforeCreate hook in my sequelize model. when i hit create user route then it saying user.user_id can't be null and even before create hook function not executing. I have followed documentation of sequelize.They have mentioned same as I use.I wrote a BeforeCreate hook in my sequelize model. when i hit create user route then it saying user.user_id can't be null and even before create hook function not executing. I have followed documentation of sequelize.They have mentioned same as I use.</p>
  
  <pre><code>const sequelize = require("kvell-db-plugin-sequelize").dbInstance;
  const Sequelize = require("kvell-db-plugin-sequelize").dbLib;
  const shortid = require("shortid");
  const User = sequelize.define(
    "user",
    {
      id: {
        type: Sequelize.INTEGER,
        autoIncrement: true,
        allowNull: false
      },
      user_id: {
        type: Sequelize.STRING,
        allowNull: false,
        primaryKey: true,
        unique: true
      },
      user_fname: {
        type: Sequelize.STRING,
        allowNull: false
      },
      user_lname: {
        type: Sequelize.STRING,
        allowNull: false
      },
      user_fullName: {
        type: Sequelize.VIRTUAL,
        get() {
          return `${this.user_fname} ${this.user_lname}`;
        },
        set(value) {
          throw new Error("Do not try to set the `fullName` value!");
        }
      },
      user_email: {
        type: Sequelize.STRING,
        allowNull: false,
        primaryKey: true,
        validate: {
          isEmail: true
        },
  
        unique: {
          args: true,
          msg: "Email address already in use!"
        }
      },
      user_credential: {
        type: Sequelize.STRING,
        allowNull: false
      },
      user_roles: {
        type: Sequelize.ARRAY(Sequelize.STRING),
        allowNull: false,
        defaultValue: ["Admin"]
      },
      admin: {
        type: Sequelize.BOOLEAN,
        allowNull: false,
        defaultValue: true
      },
      user_img: {
        type: Sequelize.STRING,
        allowNull: true
      }
    },
    {
      timestamps: true
  
   }
  );
  
  User.beforeCreate(async (user, options) =&gt; {
    console.log("inside hooks");
    let id = `user_${shortid.generate()}`;
    user.user_id = id;
  });
  
  const toJSON = User.prototype.toJSON;
  
  User.prototype.toJSON = function({ attributes = [] } = {}) {
    const obj = toJSON.call(this);
  
    if (!attributes.length) {
      return obj;
    }
  
    return attributes.reduce((result, attribute) =&gt; {
      result[attribute] = obj[attribute];
  
      return result;
    }, {});
  };
  
  module.exports = User;
  </code></pre>