7 changed files with 96 additions and 10 deletions
@ -0,0 +1,34 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
/** @type {import('sequelize-cli').Migration} */ |
||||
|
module.exports = { |
||||
|
async up (queryInterface, Sequelize) { |
||||
|
const transaction = await queryInterface.sequelize.transaction(); |
||||
|
try { |
||||
|
await queryInterface.addColumn( |
||||
|
'Users', |
||||
|
'googleTokens', |
||||
|
{ |
||||
|
type: Sequelize.STRING, |
||||
|
allowNull: true, |
||||
|
}, |
||||
|
{ transaction } |
||||
|
); |
||||
|
await transaction.commit(); |
||||
|
} catch (err) { |
||||
|
await transaction.rollback(); |
||||
|
throw err; |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
async down (queryInterface, Sequelize) { |
||||
|
const transaction = await queryInterface.sequelize.transaction(); |
||||
|
try { |
||||
|
await queryInterface.removeColumn('Users', 'googleTokens', { transaction }); |
||||
|
await transaction.commit(); |
||||
|
} catch (err) { |
||||
|
await transaction.rollback(); |
||||
|
throw err; |
||||
|
} |
||||
|
} |
||||
|
}; |
||||
Loading…
Reference in new issue