hedgedoc/lib/migrations/20180525153000-user-add-delete-token.js

22 lines
679 B
JavaScript
Raw Normal View History

'use strict'
module.exports = {
up: function (queryInterface, Sequelize) {
return queryInterface.addColumn('Users', 'deleteToken', {
type: Sequelize.UUID,
defaultValue: Sequelize.UUIDV4
}).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
}
})
},
down: function (queryInterface, Sequelize) {
return queryInterface.removeColumn('Users', 'deleteToken')
}
}