Last active
June 3, 2019 10:03
-
-
Save v-vashchenko/feb781e79b4bd696a8f3dd86e7f5857c to your computer and use it in GitHub Desktop.
Migration extend enum postgres SEQUELIZE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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