I've generated a model using node_modules/.bin/sequelize model:create --name Student --attributes firstName:string,email:string
. Now I want to add a new column, major
. I know you can manually create a migration like so:
module.exports = {
up: function(queryInterface, Sequelize) {
// logic for transforming into the new state
return queryInterface.addColumn(
'major',
'compSci',
Sequelize.BOOLEAN
);
},
down: function(queryInterface, Sequelize) {
// logic for reverting the changes
return queryInterface.removeColumn(
'major',
'compSci'
);
}
}
Is it possible to edit the model, and have migrations be automatically created? So in student.js you'd add {major:{type:Sequelize.STRING}}
, and then generate new migrations?