I am trying to add a column using sequelize-cli migration (http://docs.sequelizejs.com/manual/tutorial/migrations.html). This is the structure -config/config.json -migrations -models -models/index.js
I am trying to run a migration script which is as follows:
'use strict';
module.exports = {
up: function(queryInterface, Sequelize) {
return queryInterface.addColumn('faltus','HelpFlag',Sequelize.INTEGER)
},
down: function(queryInterface, Sequelize) {
return queryInterface.removeColumn('faltus','HelpFlag')
}
};
I am running the script using 'sequelize db:migrate' command. On terminal, the migartion script is successful. MigrationsuccessImage
But when I check the new column in my postgres database, I can't see any 'HelpFlag' column. I tried to rerun the same script by removing the entry in sequelize-meta.json (store all the migartions). I get error: column "HelpFlag" of relation "faltus" already exists.
Your query should be ...addColumn('faltus', 'HelpFlag', {type: Sequelize.Integer})
. Third parameter is an object