title: SequelizeUniqueConstraintError during seed
body: <p>I have a node.js application that uses Sequelize. I'm currently targeting SQLite for easy dev setup and testing but will be moving to MySQL for production. I used the sequelize-cli to create the models and migrations and all worked without any issues, I have confirmed that the tables were created using a SQLite browser tool. The problem I have now is when running the seed file that I have below (The database is currently empty) I receive the following error.</p>
  
  <p>Error:</p>
  
  <pre><code>Unhandled rejection SequelizeUniqueConstraintError: Validation error
  at Query.formatError (/Users/abc/repos/myProject/node_modules/sequelize/lib/dialects/sqlite/query.js:231:14)
  at Statement.&lt;anonymous&gt; (/Users/abc/repos/myProject/node_modules/sequelize/lib/dialects/sqlite/query.js:47:29)
  at Statement.replacement (/Users/abc/repos/myProject/node_modules/sqlite3/lib/trace.js:20:31)
  </code></pre>
  
  <p>The migration:</p>
  
  <pre><code>'use strict';
  module.exports = {
    up: function(queryInterface, Sequelize) {
      return queryInterface.createTable('Questions', {
        id: {
          allowNull: false,
          autoIncrement: true,
          primaryKey: true,
          type: Sequelize.INTEGER
        },
        type: {
          allowNull: false,
          type: Sequelize.INTEGER
        },
        text: {
          allowNull: false,
          type: Sequelize.STRING
        },
        nextQuestionId: {
          type: Sequelize.INTEGER
        },
        createdAt: {
          allowNull: false,
          type: Sequelize.DATE
        },
        updatedAt: {
          allowNull: false,
          type: Sequelize.DATE
        }
      });
    },
    down: function(queryInterface, Sequelize) {
      return queryInterface.dropTable('Questions');
    }
  };
  </code></pre>
  
  <p>The model:</p>
  
  <pre><code>'use strict';
  module.exports = function(sequelize, DataTypes) {
    var Question = sequelize.define('Question', {
      id: {
        allowNull: false,
        autoIncrement: true,
        primaryKey: true,
        type: DataTypes.INTEGER
      },
      type: {
        allowNull: false,
        type: DataTypes.INTEGER
      },
      text: {
        allowNull: false,
        type: DataTypes.STRING
      },
      nextQuestionId: {
        type: DataTypes.INTEGER
      }
    }, {
      classMethods: {
        associate: function(models) {
          Question.belongsTo(Question, {as: 'nextQuestion', foreignKey: 'nextQuestionId'});
          Question.hasMany(models.Answer);
          Question.hasMany(models.questionoption, {as: 'options'});
        }
      }
    });
    return Question;
  };
  </code></pre>
  
  <p>The seed:</p>
  
  <pre><code>'use strict';
  module.exports = {
    up: function (queryInterface, Sequelize) {
      return queryInterface.bulkInsert('Questions', [
        {type: 0, text: 'Question A'},
        {type: 5, text: 'Question B', nextQuestionId: 4},
        {type: 5, text: 'Question C', nextQuestionId: 4},
        {type: 0, text: 'Question D'},
        {type: 0, text: 'Question E'},
        {type: 0, text: 'Question F'},
        {type: 0, text: 'Question G'},
        {type: 0, text: 'Question H'},
        {type: 0, text: 'Question I'}
      ], {});
    } ...
  </code></pre>
  
  <p>I have tried looking though the documentation and googling for answers, nothing seems to hint at this being a common problem. I didn't define any unique columns (other than the primary key of course, but it's an autoIncrement) If I had more information or clues as to which column was causing the issue from the cli then I would at least be able to try some different things, but no help there. I've tried running the equivalent inserts manually in SQL and they work, so I don't think it's the DB rejecting the insert, it appears to be something internal to Sequelize.</p>
  
  <p>Any help would be greatly appreciated as I have been trying a few options for a few days now with no luck.</p>