Skip to content

removeColumn on down action of migration not working #465

Open
@Epyon616

Description

@Epyon616

Hi all,

I've been using Sequelize and Sequelize CLI for a few weeks now and have come across a bit of an issue.

I have a migration that adds columns to an existing table in the up action and should remove them if the migration is rolled back however this is not happening and instead the rollback is claiming it was successful but it's actually leaving the columns in place. Which means when you run the migration again Sequelize complains that the columns already exist.

I'm sure This is bound to be a simple oversight on my part but I thought I would ask on here as based on all the documentation I have read it would appear everything is correct. Here is an the migration in question:

module.exports = {
  up: (queryInterface, Sequelize) => {
    return [
      queryInterface.addColumn('playlist', 'createdBy', Sequelize.INTEGER),
      queryInterface.addColumn('playlist', 'modifiedBy', Sequelize.INTEGER),
  },

  down: (queryInterface, Sequelize) => {
    return [
      queryInterface.removeColumn('playlist', 'createdBy'),
      queryInterface.removeColumn('playlist', 'modifiedBy'),
    ];
  },
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions