title: Sequelize null value in column violates not-null constraint
body: <p>I'm getting this error when trying to associate a like to a post. </p>
  
  <blockquote>
    <p>Unhandled rejection SequelizeDatabaseError: null value in column
    "userId" violates not-null constraint</p>
  </blockquote>
  
  <p>Now the following code gets the post id and user id ok, i did a <code>console log</code>. What could i be doing wrong ?</p>
  
  <p><strong>routes/posts.js</strong></p>
  
  <pre><code>router.post('/:userId/like/:postId', (req, res)=&gt; {
      models.Post.findOne({
        where:{
            id: req.params.postId
        }
      })
      .then( (like) =&gt; {
          if(like){
              models.Likes.create({
                  where:{
                      userId: req.params.userId,
                      postId: req.params.postId
                  },
                  like:true
  
              }).then( (result) =&gt; {
                  res.status(200).send({
                      message: 'You have like this post',
                      like: result
                  })
              })
          }
      }).catch( (err) =&gt; {
          res.status(401).send({
              message: "Something went wrong",
              err: err
          })
      })
  
  })
  </code></pre>
  
  <p>here is the <strong>likes migration</strong></p>
  
  <pre><code>  up: (queryInterface, Sequelize) =&gt; {
      return queryInterface.createTable('Likes', {
        id: {
          allowNull: false,
          autoIncrement: true,
          primaryKey: true,
          type: Sequelize.INTEGER
        },
        like: {
          type: Sequelize.BOOLEAN
        },
        userId: {
          allowNull: false,
          type: Sequelize.INTEGER,
          references: {
            model: 'Users',
            key: 'id'
          }
        },
        createdAt: {
          allowNull: false,
          type: Sequelize.DATE
        },
        updatedAt: {
          allowNull: false,
          type: Sequelize.DATE
        }
      });
    },
    down: (queryInterface, Sequelize) =&gt; {
      return queryInterface.dropTable('Likes');
    }
  };
  </code></pre>
  
  <p><strong>Posts migration</strong></p>
  
  <pre><code>'use strict';
  module.exports = {
    up: (queryInterface, Sequelize) =&gt; {
      return queryInterface.createTable('Posts', {
        id: {
          allowNull: false,
          autoIncrement: true,
          primaryKey: true,
          type: Sequelize.INTEGER
        },
        title: {
          type: Sequelize.STRING
        },
        post_content: {
          type: Sequelize.STRING
        },
        createdAt: {
          allowNull: false,
          type: Sequelize.DATE
        },
        updatedAt: {
          allowNull: false,
          type: Sequelize.DATE
        },
        userId: {
          type: Sequelize.INTEGER,
          references: {
            model: 'Users',
            key: 'id'
          }
        },
        username: {
          type: Sequelize.STRING
        },
      });
    },
    down: (queryInterface, Sequelize) =&gt; {
      return queryInterface.dropTable('Posts');
    }
  };
  </code></pre>
  
  <p><strong>Like model</strong></p>
  
  <pre><code>'use strict';
  module.exports = function(sequelize, DataTypes) {
    const Like = sequelize.define('Likes', {
      like:{
        type:DataTypes.BOOLEAN,
        allowNull:true
      }
    }, {});
      Like.associate = function(models) {
          Like.belongsTo(models.User, {
            onDelete: "CASCADE",
            sourceKey: 'userId'
  
          })
          Like.belongsTo(models.Post, {
            onDelete: "CASCADE",
            sourceKey: 'likeId'
  
          })
      }
    return Like;
  }
  </code></pre>
  
  <p><strong>Post.model</strong></p>
  
  <pre><code>module.exports = (sequelize, DataTypes) =&gt; {
    const Post = sequelize.define('Post', {
      title: DataTypes.STRING,
      post_content: DataTypes.STRING,
      username:  DataTypes.STRING
    }, {});
    Post.associate = function(models) {
      Post.belongsTo(models.User, {  foreignKey: 'userId',  targetKey: 'id' });
      Post.hasMany(models.Likes, {  foreignKey: 'postId',  sourceKey: 'id' });
    };
    return Post;
  };
  </code></pre>
  
  <p>extra</p>
  
  <p><em>add_postId_to_likes</em></p>
  
  <pre><code>'use strict';
  module.exports = {
    up: function (queryInterface, Sequelize) {
       return queryInterface.addColumn(
        'Likes',
        'postId',
        {
          type: Sequelize.INTEGER,
          allowNull: true,
          references: {
            model: 'Posts',
            key: 'id',
  
          }
        }
      )
    },
  
    down: function (queryInterface, Sequelize) {
       return queryInterface.removeColumn(
       'Likes',
       'postId'
     )
    }
  };
  </code></pre>