title: How to extend a Sequelize model?
body: <p>Is there a way that I could use a base class that has all the common attributes and methods for my models but not linked with a database table, and then I could extend this base class when defining new models.</p>
  
  <p>Here I have created the base, person model in node express. I need the person class to be extended from the base class.</p>
  
  <pre><code>const person = sequelizeClient.define('person', {
      name: {
        type: DataTypes.STRING,
        allowNull: false
      }
    }, {
      hooks: {
        beforeCount(options) {
          options.raw = true;
        }
      }
    });
  
    const base = sequelizeClient.define('base', {
      id: {
        type: Sequelize.INTEGER,
        autoIncrement: true,
        primaryKey: true
      },
      createdBy: {
        type: Sequelize.INTEGER,
      },
      updatedBy: {
        type: Sequelize.INTEGER,
      },
      deletedBy: {
        type: Sequelize.INTEGER,
      }
    }, {
      hooks: {
        beforeCount(options) {
          options.raw = true;
        }
      }
    });
  </code></pre>
  
  <p>In the documentation it's stated that </p>
  
  <blockquote>
    <p>Sequelize Models are ES6 classes.You can very easily add custom instance or class level methods.</p>
  </blockquote>
  
  <p>How can I do this using ES6 extends class pattern?</p>
  
  <p>There's a question similar to this but has not been updated recently.
  <a href="https://stackoverflow.com/questions/19682171/how-to-extend-sequelize-model">How to extend Sequelize model</a></p>