Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jeonghwan-kim/5c6eccad7500c48a17ba to your computer and use it in GitHub Desktop.
Save jeonghwan-kim/5c6eccad7500c48a17ba to your computer and use it in GitHub Desktop.
module.exports = {
up: function (queryInterface, Sequelize) {
return [
queryInterface.addColumn('User', 'name', {
type: Sequelize.STRING
}),
queryInterface.addColumn('User', 'nickname', {
type: Sequelize.STRING,
})
];
},
down: function (queryInterface, Sequelize) {
return [
queryInterface.removeColumn('Challenges', 'name'),
queryInterface.removeColumn('Challenges', 'nickname')
];
}
};
@tawfiknasser
Copy link

migrate function should return promise so add Promise.all

module.exports = {
  up: function (queryInterface, Sequelize) {
    return Promise.all([
      queryInterface.addColumn('User', 'name', {
        type: Sequelize.STRING
      }),
      queryInterface.addColumn('User', 'nickname', {
        type: Sequelize.STRING,
      })
    ]);
  },

  down: function (queryInterface, Sequelize) {
    return Promise.all([
      queryInterface.removeColumn('User', 'name'),
      queryInterface.removeColumn('User', 'nickname')
    ]);
  }
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment