title: Sequelize database error colum name does not exists
body: <p>The problem is a <code>findAll</code> product a select with a column which does not exist "PermissionId"</p>
  
  <p>I don't understand why sequelize generate this column.</p>
  
  <p>The error are:</p>
  
  <blockquote>
    <p>Unhandled rejection SequelizeDatabaseError: column "PermissionId" does not exist
            at Query.formatError (/home/baptiste/IUT2/ProjetS3/code/M3301/node_modules/sequelize/lib/dialects/postgres/query.js:366:16)
            at /home/baptiste/IUT2/ProjetS3/code/M3301/node_modules/sequelize/lib/dialects/postgres/query.js:72:18
            at tryCatcher (/home/baptiste/IUT2/ProjetS3/code/M3301/node_modules/bluebird/js/release/util.js:16:23)
            at Promise._settlePromiseFromHandler (/home/baptiste/IUT2/ProjetS3/code/M3301/node_modules/bluebird/js/release/promise.js:547:31)
            at Promise._settlePromise (/home/baptiste/IUT2/ProjetS3/code/M3301/node_modules/bluebird/js/release/promise.js:604:18)
            at Promise._settlePromise0 (/home/baptiste/IUT2/ProjetS3/code/M3301/node_modules/bluebird/js/release/promise.js:649:10)
            at Promise._settlePromises (/home/baptiste/IUT2/ProjetS3/code/M3301/node_modules/bluebird/js/release/promise.js:725:18)
            at _drainQueueStep (/home/baptiste/IUT2/ProjetS3/code/M3301/node_modules/bluebird/js/release/async.js:93:12)
            at _drainQueue (/home/baptiste/IUT2/ProjetS3/code/M3301/node_modules/bluebird/js/release/async.js:86:9)
            at Async._drainQueues (/home/baptiste/IUT2/ProjetS3/code/M3301/node_modules/bluebird/js/release/async.js:102:5)
            at Immediate.Async.drainQueues [as _onImmediate] (/home/baptiste/IUT2/ProjetS3/code/M3301/node_modules/bluebird/js/release/async.js:15:14)
            at processImmediate (internal/timers.js:439:21)</p>
  </blockquote>
  
  <p>migrations code:</p>
  
  <p><strong>Utilisateurs tables</strong></p>
  
  <pre class="lang-js prettyprint-override"><code>    'use strict';
      module.exports = {
          up: (queryInterface, Sequelize) =&gt; {
              return queryInterface.createTable('Utilisateurs', {
                  id: {
                      allowNull: false,
                      autoIncrement: true,
                      primaryKey: true,
                      type: Sequelize.INTEGER
                  },
                  adresseMail: {
                      type: Sequelize.STRING
                  },
                  nomUtilisateur: {
                      type: Sequelize.STRING
                  },
                  dateDeNaissance: {
                      type: Sequelize.STRING
                  },
                  motDePasse: {
                      type: Sequelize.STRING
                  },
                  createdAt: {
                      allowNull: false,
                      type: Sequelize.DATE
                  },
                  updatedAt: {
                      allowNull: false,
                      type: Sequelize.DATE
                  },
                  idPermission: {
                      type: Sequelize.INTEGER,
                      references: {
                          model: {
                              tableName: 'Permissions',
                              schema: 'public'
                          },
                          key: 'id'
                      }
                  }
              });
          },
          down: (queryInterface, Sequelize) =&gt; {
              return queryInterface.dropTable('Utilisateurs');
          }
      };
  </code></pre>
  
  <p><strong>Permissions tables</strong></p>
  
  <pre class="lang-js prettyprint-override"><code>'use strict';
      module.exports = {
          up: (queryInterface, Sequelize) =&gt; {
              return queryInterface.createTable('Permissions', {
                  id: {
                      allowNull: false,
                      autoIncrement: true,
                      primaryKey: true,
                      type: Sequelize.INTEGER
                  },
                  estRegatier: {
                      type: Sequelize.BOOLEAN
                  },
                  estJury: {
                      type: Sequelize.BOOLEAN
                  },
                  estOrganisateur: {
                      type: Sequelize.BOOLEAN
                  },
                  createdAt: {
                      allowNull: false,
                      type: Sequelize.DATE
                  },
                  updatedAt: {
                      allowNull: false,
                      type: Sequelize.DATE
                  }
              });
          },
          down: (queryInterface, Sequelize) =&gt; {
              return queryInterface.dropTable('Permissions');
          }
      };
      ```
      'use strict';
      module.exports = {
          up: (queryInterface, Sequelize) =&gt; {
              return queryInterface.createTable('Permissions', {
                  id: {
                      allowNull: false,
                      autoIncrement: true,
                      primaryKey: true,
                      type: Sequelize.INTEGER
                  },
                  estRegatier: {
                      type: Sequelize.BOOLEAN
                  },
                  estJury: {
                      type: Sequelize.BOOLEAN
                  },
                  estOrganisateur: {
                      type: Sequelize.BOOLEAN
                  },
                  createdAt: {
                      allowNull: false,
                      type: Sequelize.DATE
                  },
                  updatedAt: {
                      allowNull: false,
                      type: Sequelize.DATE
                  }
              });
          },
          down: (queryInterface, Sequelize) =&gt; {
              return queryInterface.dropTable('Permissions');
          }
      };
      ```
      models code :
      **Utilisateur**
      ```'use strict';
      module.exports = (sequelize, DataTypes) =&gt; {
          const Utilisateurs = sequelize.define('Utilisateur', {
              adresseMail: DataTypes.STRING,
              nomUtilisateur: DataTypes.STRING,
              dateDeNaissance: DataTypes.STRING,
              motDePasse: DataTypes.STRING,
              idPermission: DataTypes.INTEGER
          }, {});
          Utilisateurs.associate = function (models) {
              Utilisateurs.belongsTo(models.Permission);
              Utilisateurs.hasMany(models.Licencie);
          };
          return Utilisateurs;
      };
  </code></pre>
  
  <p><strong>Permission</strong></p>
  
  <pre class="lang-js prettyprint-override"><code>'use strict';
  
      module.exports = (sequelize, DataTypes) =&gt; {
          const Permission = sequelize.define('Permission', {
              estRegatier: DataTypes.BOOLEAN,
              estJury: DataTypes.BOOLEAN,
              estOrganisateur: DataTypes.BOOLEAN
          }, {});
          Permission.associate = function (models) {
              Permission.hasMany(models.Utilisateur);
          };
          return Permission;
      };
  </code></pre>