Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
'use strict';

/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
const transaction = await queryInterface.sequelize.transaction();

try {
const task = await queryInterface.describeTable('weavejs_task');

if (!task.ImageModelRoomId) {
await queryInterface.addColumn(
'weavejs_task',
'ImageModelRoomId',
{
type: Sequelize.STRING,
allowNull: true,
},
{ transaction },
);
}

if (!task.VideoModelRoomId) {
await queryInterface.addColumn(
'weavejs_task',
'VideoModelRoomId',
{
type: Sequelize.STRING,
allowNull: true,
},
{ transaction },
);
}

await transaction.commit();
} catch (error) {
await transaction.rollback();
throw error;
}
},

async down(queryInterface) {
const transaction = await queryInterface.sequelize.transaction();

try {
const task = await queryInterface.describeTable('weavejs_task');

if (task.ImageModelRoomId) {
await queryInterface.removeColumn(
'weavejs_task',
'ImageModelRoomId',
{ transaction },
);
}

if (task.VideoModelRoomId) {
await queryInterface.removeColumn(
'weavejs_task',
'VideoModelRoomId',
{ transaction },
);
}

await transaction.commit();
} catch (error) {
await transaction.rollback();
throw error;
}
},
};
Loading