title: How do I stop sequelize from creating an unwanted primary key when inserting data?
body: <p>I have a sequelize model without any primary key:</p>
  
  <pre><code>module.exports = (sequelize, DataTypes) =&gt; {
    const usersDoors = sequelize.define('usersDoors',
      {
        user_uid: {
          type: DataTypes.UUID,
          allowNull: false,
        },
        door_uid: {
          type: DataTypes.UUID,
          allowNull: false,
        },
        property_manager_uid: {
          type: DataTypes.UUID,
          allowNull: true,
        },
        tenant_uid: {
          type: DataTypes.UUID,
          allowNull: true,
        },
        created_at: {
          type: DataTypes.INTEGER,
          allowNull: false,
        },
      },
      {
        tableName: 'users_doors',
        indexes: [
          {
            name: 'doors_users_indexes',
            unique: true,
            fields: ['user_uid', 'door_uid', 'property_manager_uid', 'tenant_uid'],
          },
        ],
        classMethods: {
          associate: (models) =&gt; {
            usersDoors.belongsTo(models.users, { foreignKey: 'user_uid' });
            usersDoors.belongsTo(models.doors, { foreignKey: 'door_uid' });
            usersDoors.belongsTo(models.propertyManagers, { foreignKey: 'property_manager_uid' });
            usersDoors.belongsTo(models.tenants, { foreignKey: 'tenant_uid' });
          },
        },
      });
  
    return usersDoors;
  };
  </code></pre>
  
  <p>When I insert data (via sequelize), sequelize adds a composite primary key to the table which includes the first 2 columns (user_uid and door_uid). This is breaking my stuff and I don't want it.</p>
  
  <p>How can I stop sequelize from creating an unwanted primary key when inserting data?</p>
  
  <p>More details:</p>
  
  <ul>
  <li>dialect: postgresql</li>
  <li>sequelize (the node package) version: 3.30.2</li>
  <li>postgresql version: psql (9.6.1, server 9.5.5)</li>
  <li>node version (this has nothing to do with anything): 6.9.1</li>
  </ul>
  
  <p>And finally, here is the sequelize migration for this model:</p>
  
  <pre><code>const tableName = 'users_doors';
  module.exports = {
    up: (queryInterface, Sequelize) =&gt; {
      return queryInterface.createTable(tableName, {
        user_uid: {
          type: Sequelize.UUID,
          allowNull: false,
          references: {
            model: 'users',
            key: 'uid',
          },
        },
        door_uid: {
          type: Sequelize.UUID,
          allowNull: false,
          references: {
            model: 'doors',
            key: 'uid',
          },
        },
        property_manager_uid: {
          type: Sequelize.UUID,
          allowNull: true,
          references: {
            model: 'property_managers',
            key: 'uid',
          },
        },
        tenant_uid: {
          type: Sequelize.UUID,
          allowNull: true,
          references: {
            model: 'tenants',
            key: 'uid',
          },
        },
        created_at: {
          type: Sequelize.INTEGER,
          allowNull: false,
        },
      })
        .then(() =&gt; {
          return queryInterface.addIndex('users_doors',
            ['user_uid', 'door_uid', 'property_manager_uid', 'tenant_uid'],
            {
              indexName: 'doors_users_indexes',
              indicesType: 'UNIQUE',
            });
        });
    },
  
    down: (queryInterface) =&gt; {
      return queryInterface.dropTable(tableName)
        .then(() =&gt; {
          return queryInterface.removeIndex('users_doors', ['user_uid', 'door_uid', 'property_manager_uid', 'tenant_uid']);
        });
    },
  };
  </code></pre>