I am starting with sequelize and was following their video tutorial online. After running
node_modules/.bin/sequelize model:create --name User --attributes username:string
node_modules/.bin/sequelize model:create --name Task --attributes title:string
which created the migration files for create user and create task. Then I had to add the associations to each model as follow:
// user.js
classMethods: {
associate: function(models) {
User.hasMany(models.Task);
}
}
// task.js
classMethods: {
associate: function(models) {
Task.belongsTo(models.User);
}
}
However, the migration files for creating the tables for user and task are already created. Do i have to manually update them to add the relationships? "migration:create" command creates the migration skeleton file. Do I manually fill out the skeleton files or is there a way to automatically create the complete migration file besides model creation?
P.S i have seen the following stackoverflow question: How to auto generate migrations with Sequelize CLI from Sequelize models?