title: Sequelize sync() + foregin key , throws errors
body: <p>I have three models , user.model.js , user-log.model.js and address.model.js</p>
  
  <p>It creates tables in my db , but here user_logs and addresses have foregin key of user tables
  Each time , when I drop all the tables and run the node server it throws this error </p>
  
  <p>Code :</p>
  
  <p><strong>user.model.js</strong></p>
  
  <pre><code>var User = db.sequelize.define( 'user' , {
      ......
  });
  
  module.exports = User;
  </code></pre>
  
  <hr>
  
  <p><strong>user-log.model.js</strong></p>
  
  <pre><code>var User = require('./user.model');
  
  var Userlog = db.sequelize.define( 'user_log' , {
      user_id : {
          type: db.Sequelize.INTEGER,
      }
      ........
  );
  
  
  Userlog.belongsTo(User,{foreignKey: 'user_id'});
  User.hasMany(Userlog,{foreignKey: 'user_id'});
  
  Userlog.sync();
  
  module.exports = Userlog;
  </code></pre>
  
  <hr>
  
  <p><strong>address.model.js</strong></p>
  
  <pre><code>var User = require('./user.model');
  
  var Address = db.sequelize.define('address' , {
      user_id : {
          type : db.Sequelize.INTEGER,
      }
      ......
  );
  
  Address.belongsTo( User , {foreignKey: 'user_id'} );
  User.hasMany( Address , {foreignKey: 'user_id'} );
  
  Address.sync();
  
  module.exports = Address;
  </code></pre>
  
  <p>Error :</p>
  
  <pre><code>[nodemon] starting `node server.js`
  Executing (default): SELECT 1+1 AS result
  Executing (default): CREATE TABLE IF NOT EXISTS `users` (`id` INTEGER NOT NULL auto_increment , `firstname` VARCHAR(255) NOT NULL, `lastname` VARCHAR(255) NOT NULL, `email_id` VARCHAR(255) NOT NULL UNIQUE, `fb_id` VARCHAR(255), `password` VARCHAR(255), `comapany_id` INTEGER DEFAULT 0, `user_type` INTEGER DEFAULT 2, `anonymous` TINYINT(1) DEFAULT false, `admin_anonymous` TINYINT(1) DEFAULT false, `status` TINYINT(1) DEFAULT false, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL, UNIQUE `users_email_id_unique` (`email_id`), PRIMARY KEY (`id`)) ENGINE=InnoDB;
  Executing (default): CREATE TABLE IF NOT EXISTS `user_logs` (`id` INTEGER NOT NULL auto_increment , `user_id` INTEGER, `platform` INTEGER DEFAULT 0, `login_time` DATETIME DEFAULT '2017-08-09 11:06:47', PRIMARY KEY (`id`), FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE) ENGINE=InnoDB;
  Executing (default): CREATE TABLE IF NOT EXISTS `addresses` (`id` INTEGER NOT NULL auto_increment , `user_id` INTEGER, `line_1` VARCHAR(255), `line_2` VARCHAR(255), `line_3` VARCHAR(255), `city` VARCHAR(255), `state` VARCHAR(255), `country` VARCHAR(255), `zipcode` VARCHAR(255), `lat` VARCHAR(255), `lang` VARCHAR(255), `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL, PRIMARY KEY (`id`), FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE) ENGINE=InnoDB;
  Connection has been established successfully.
  Unhandled rejection SequelizeDatabaseError: Cannot add foreign key constraint
      at Query.formatError (/var/opt/roundTable/node_modules/sequelize/lib/dialects/mysql/query.js:222:16)
      at Query.connection.query [as onResult] (/var/opt/roundTable/node_modules/sequelize/lib/dialects/mysql/query.js:55:23)
      at Query.Command.execute (/var/opt/roundTable/node_modules/mysql2/lib/commands/command.js:30:12)
      at Connection.handlePacket (/var/opt/roundTable/node_modules/mysql2/lib/connection.js:515:28)
      at PacketParser.onPacket (/var/opt/roundTable/node_modules/mysql2/lib/connection.js:94:16)
      at PacketParser.executeStart (/var/opt/roundTable/node_modules/mysql2/lib/packet_parser.js:77:14)
      at Socket.&lt;anonymous&gt; (/var/opt/roundTable/node_modules/mysql2/lib/connection.js:102:29)
      at emitOne (events.js:96:13)
      at Socket.emit (events.js:188:7)
      at readableAddChunk (_stream_readable.js:176:18)
      at Socket.Readable.push (_stream_readable.js:134:10)
      at TCP.onread (net.js:547:20)
  
  Unhandled rejection SequelizeDatabaseError: Cannot add foreign key constraint
      at Query.formatError (/var/opt/roundTable/node_modules/sequelize/lib/dialects/mysql/query.js:222:16)
      at Query.connection.query [as onResult] (/var/opt/roundTable/node_modules/sequelize/lib/dialects/mysql/query.js:55:23)
      at Query.Command.execute (/var/opt/roundTable/node_modules/mysql2/lib/commands/command.js:30:12)
      at Connection.handlePacket (/var/opt/roundTable/node_modules/mysql2/lib/connection.js:515:28)
      at PacketParser.onPacket (/var/opt/roundTable/node_modules/mysql2/lib/connection.js:94:16)
      at PacketParser.executeStart (/var/opt/roundTable/node_modules/mysql2/lib/packet_parser.js:77:14)
      at Socket.&lt;anonymous&gt; (/var/opt/roundTable/node_modules/mysql2/lib/connection.js:102:29)
      at emitOne (events.js:96:13)
      at Socket.emit (events.js:188:7)
      at readableAddChunk (_stream_readable.js:176:18)
      at Socket.Readable.push (_stream_readable.js:134:10)
      at TCP.onread (net.js:547:20)
  
  Executing (default): SHOW INDEX FROM `users`
  Executing (default): SELECT `id`, `firstname`, `lastname`, `email_id`, `fb_id`, `password`, `comapany_id`, `user_type`, `anonymous`, `admin_anonymous`, `status`, `created_at`, `updated_at` FROM `users` AS `user`;
  Executing (default): INSERT INTO `users` (`id`,`firstname`,`lastname`,`email_id`,`password`,`comapany_id`,`user_type`,`anonymous`,`admin_anonymous`,`status`,`created_at`,`updated_at`) VALUES (DEFAULT,'admin','admin','admin','changed',0,1,false,false,false,'2017-08-09 11:06:47','2017-08-09 11:06:47');
  </code></pre>