2018-05-25 12:19:31 -04:00
|
|
|
'use strict'
|
|
|
|
module.exports = {
|
|
|
|
up: function (queryInterface, Sequelize) {
|
|
|
|
return queryInterface.addColumn('Users', 'deleteToken', {
|
|
|
|
type: Sequelize.UUID,
|
|
|
|
defaultValue: Sequelize.UUIDV4
|
2020-12-02 11:22:27 -05:00
|
|
|
}).catch(function (error) {
|
|
|
|
if (error.message.toLowerCase().includes('duplicate column name') ||
|
|
|
|
error.message === 'column "deleteToken" of relation "Users" already exists') {
|
|
|
|
// eslint-disable-next-line no-console
|
|
|
|
console.log('Migration has already run… ignoring.')
|
|
|
|
} else {
|
|
|
|
throw error
|
|
|
|
}
|
2018-05-25 12:19:31 -04:00
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
down: function (queryInterface, Sequelize) {
|
|
|
|
return queryInterface.removeColumn('Users', 'deleteToken')
|
|
|
|
}
|
|
|
|
}
|