I am trying to execute multiple migration statements in a single migration file to make changes to multiple columns of the same table at a time.
I want to know that I am doing this in writing order or not or is there a better and more suitable way to do this:
Migration code
module.exports = { up: function(queryInterface, Sequelize, done) { queryInterface.changeColumn('users', 'name', { type: Sequelize.STRING, allowNull: false, require: true, unique: true }).success(function() { queryInterface.changeColumn('users', 'address', { type: Sequelize.STRING, allowNull: false, require: true, unique: true }).success(function() { queryInterface.changeColumn('users', 'city', { type: Sequelize.STRING, allowNull: false, require: true, unique: true }).success(function() { queryInterface.changeColumn('users', 'state', { type: Sequelize.STRING, allowNull: false, require: true, defaultValue: "ncjnbcb" }); done(); }); }); }); } };
But I encounter an error that reads:
TypeError: undefined is not a function
Since I could not find a way to debug migration errors, it would be great if someone helps me in solving it or, if possible, tell us about how we can calculate errors in migration.