'How to add new ENUM value to existing table using sequalize in PostgreSQL database?
Let's say I created some table in my PostgreSQL database using sequelize:
status: {
type: Sequelize.ENUM(["approved", "rejected", "new"]),
allowNull: true
},
As you can see, there are 3 ENUM values, now, I need to add one more ENUM value using new migration. I was trying to do this something like this, but it doesn't work:
'use strict';
module.exports = {
async up (queryInterface, Sequelize) {
return queryInterface.sequelize.query("ALTER TABLE risky_transactions ALTER COLUMN status ADD VALUE 'question';")
},
async down (queryInterface, Sequelize) {
}
};
So, how can I do this? No matter how, using query or pure sequelize syntax.
Thanks!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
