diff --git a/server/migrations/20221218013627-fix-webhook-subscription-constraints.js b/server/migrations/20221218013627-fix-webhook-subscription-constraints.js new file mode 100644 index 000000000..37e232ed2 --- /dev/null +++ b/server/migrations/20221218013627-fix-webhook-subscription-constraints.js @@ -0,0 +1,26 @@ +'use strict'; + +module.exports = { + up: async (queryInterface, Sequelize) => { + await queryInterface.removeConstraint("webhook_subscriptions", "webhook_subscriptions_teamId_fkey") + await queryInterface.changeColumn("webhook_subscriptions", "teamId", { + type: Sequelize.UUID, + allowNull: false, + onDelete: "cascade", + references: { + model: "teams", + }, + }); + }, + + down: async (queryInterface, Sequelize) => { + await queryInterface.removeConstraint("webhook_subscriptions", "webhook_subscriptions_teamId_fkey") + await queryInterface.changeColumn("webhook_subscriptions", "teamId", { + type: Sequelize.UUID, + allowNull: false, + references: { + model: "teams", + }, + }); + } +};