'changing the name of a foreign key column in sequelize

I am trying to change the name of a foreign key column in my sequelize table and am not sure exactly how to remove the constraint that is preventing me from making the change. I know I have to remove the constraint, change the name, and add the constraint back but I don't know if it's because of the references key or the type key. If anyone has any knowledge on this that would be so helpful!

here is how it looks in the model:

 public static model_attributes = () => ({
    ...ParanoidMutable.model_attributes(),
    mapping_id: {
      type: DataTypes.UUID,
      allowNull: false,
      references: {
        model: 'mappings',
        key: 'id',
      },
    },

here is my current migration file:

module.exports = {
  up: async (queryInterface) => {
    await queryInterface.renameColumn(
      'mappings',
      'test1_mapping_id',
      'test2_mapping_id'
    );
  },

  down: async (queryInterface) => {
    await queryInterface.renameColumn(
      'mappings',
      'test2_mapping_id',
      'test1_mapping_id'
    );
  },
};


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source