While it doesn't auto generate, one way to generate new migrations on a change to a model is: (assuming that you're using the stock sequelize-cli file structure where migrations, and models are on the same level)
(Same as Manuel Bieh's suggestion, but using a require instead of an import) In your migration file (if you don't have one, you can generate one by doing "sequelize migration:create
") have the following code:
'use strict';
var models = require("../models/index.js")
module.exports = {
up: function(queryInterface, Sequelize) {
return queryInterface.createTable(models.User.tableName,
models.User.attributes);
},
down: function(queryInterface, Sequelize) {
return queryInterface.dropTable('Users');
}
};
Make a change to the User model.
sequelize db:migrate:undo:all
sequelize db:migrate