Fix object syntax for hasmany and belongsto foreign keys

Closes #2164. I've also changed so that existing attributes are properly merged with new ones. So for example if you already have an attribute `userId` in your model with allowNull set to false, and you do `User.hasMany(Model)`, we will add the proper references and constraints to the `userId` column, and keep the `allowNull` constraint
You want to do it in this PR?