From 4b66a52a5243b8cb63eea6020e53797265a1a4b2 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sat, 17 Dec 2022 21:19:55 -0500 Subject: [PATCH] fix: Missing onDelete constraint --- ...27-fix-webhook-subscription-constraints.js | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 server/migrations/20221218013627-fix-webhook-subscription-constraints.js 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", + }, + }); + } +};