You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.1 KiB
45 lines
1.1 KiB
'use strict';
|
|
|
|
/** @type {import('sequelize-cli').Migration} */
|
|
module.exports = {
|
|
async up (queryInterface, Sequelize) {
|
|
/**
|
|
* Add altering commands here.
|
|
*
|
|
* Example:
|
|
* await queryInterface.createTable('users', { id: Sequelize.INTEGER });
|
|
*/
|
|
const transaction = await queryInterface.sequelize.transaction();
|
|
try {
|
|
await queryInterface.addColumn(
|
|
'Racers',
|
|
'loginId',
|
|
{
|
|
type: Sequelize.STRING,
|
|
},
|
|
{ transaction }
|
|
);
|
|
await transaction.commit();
|
|
} catch (err) {
|
|
await transaction.rollback();
|
|
throw err;
|
|
}
|
|
},
|
|
|
|
async down (queryInterface, Sequelize) {
|
|
/**
|
|
* Add reverting commands here.
|
|
*
|
|
* Example:
|
|
* await queryInterface.dropTable('users');
|
|
*/
|
|
const transaction = await queryInterface.sequelize.transaction();
|
|
try {
|
|
await queryInterface.removeColumn('Racers', 'loginId', { transaction });
|
|
await transaction.commit();
|
|
} catch (err) {
|
|
await transaction.rollback();
|
|
throw err;
|
|
}
|
|
}
|
|
};
|
|
|