Skip to content

Instantly share code, notes, and snippets.

@v-vashchenko
Last active June 3, 2019 10:03
Show Gist options
  • Save v-vashchenko/feb781e79b4bd696a8f3dd86e7f5857c to your computer and use it in GitHub Desktop.
Save v-vashchenko/feb781e79b4bd696a8f3dd86e7f5857c to your computer and use it in GitHub Desktop.
Migration extend enum postgres SEQUELIZE
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.changeColumn(
'table',
'column',
{
type: Sequelize.TEXT,
}
),
queryInterface.sequelize.query('drop type "public"."enum_table_column";')
.then(() => queryInterface.changeColumn(
'users',
'skillsLevel',
{
type: Sequelize.ENUM('1', '2', '3', '4', '5'),
},
))
},
down: (queryInterface, Sequelize) => {
return queryInterface.changeColumn(
'table',
'column',
{
type: Sequelize.TEXT,
}
),
queryInterface.sequelize.query('drop type "public"."enum_table_column";')
.then(() => queryInterface.changeColumn(
'table',
'column',
{
type: Sequelize.ENUM('1', '2', '3', '4'),
},
))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment