title: create/update with Many to Many association in Node.js sequelize and PostgreSQL
body: <p>I am just creating or updating a table having a Many-to-Many association with another table like here:
  Company &lt;-> Industry &lt;-> CompanyIndustryRelation.</p>
  
  <p>Industry.js</p>
  
  <pre><code>'use strict';
  module.exports = (sequelize, DataTypes) =&gt; {
    const Industry = sequelize.define('Industry', {
      industry_name: DataTypes.STRING,
    }, {
      timestamps: false,
      underscored: true,
      tableName: 'industry',
    });
    Industry.associate = function(models) {
      Industry.belongsToMany(models.Company, {
        through: 'company_industry_relation', foreignkey: 'industry_id'
      });
    };
    return Industry;
  };
  </code></pre>
  
  <p>Company.js</p>
  
  <pre><code>'use strict';
  module.exports = (sequelize, DataTypes) =&gt; {
    const Company = sequelize.define('Company', {
      company_name: DataTypes.STRING,
    }, {
      timestamps: false,
      underscored: true,
      tableName: 'company',
    });
    Company.associate = function(models) {
      Company.belongsToMany(models.Industry, {
        through: 'company_industry_relation', foreignKey: 'company_id'
      });
    };
    return Company;
  };
  </code></pre>
  
  <p>CompanyIndustryRelation.js</p>
  
  <pre><code>'use strict';
  module.exports = (sequelize, DataTypes) =&gt; {
    const CompanyIndustryRelation = sequelize.define('CompanyIndustryRelation', {
      id: {
        type: DataTypes.INTEGER,
        primaryKey: true,
      },
    }, {
      timestamps: false,
      underscored: true,
      tableName: 'company_industry_relation',
    });
    return CompanyIndustryRelation;
  };
  </code></pre>
  
  <p>Currently I have the industry table already built like down below.
  <a href="https://i.stack.imgur.com/KLxYn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KLxYn.png" alt="enter image description here"></a></p>
  
  <p>Industry array
  industry = [ { label: 'Accounting' }, { label: 'Computer Science' } ]</p>
  
  <p>CompanyName: 'ApolloIT'</p>
  
  <p>I want to create a new company record with the given industry array and companyName.</p>
  
  <p>Thanks in advance!</p>