fix: Missing onDelete constraint

This commit is contained in:
Tom Moor
2022-12-18 20:49:28 -05:00
parent 9618d514e1
commit 67ec5a1a33

View File

@@ -0,0 +1,43 @@
'use strict';
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.removeConstraint("integrations", "integrations_collectionId_fkey")
await queryInterface.changeColumn("integrations", "collectionId", {
type: Sequelize.UUID,
allowNull: true,
onDelete: "cascade",
references: {
model: "collections",
},
});
await queryInterface.removeConstraint("integrations", "integrations_teamId_fkey")
await queryInterface.changeColumn("integrations", "teamId", {
type: Sequelize.UUID,
allowNull: false,
onDelete: "cascade",
references: {
model: "teams",
},
});
},
down: async (queryInterface, Sequelize) => {
await queryInterface.removeConstraint("integrations", "integrations_collectionId_fkey")
await queryInterface.changeColumn("integrations", "collectionId", {
type: Sequelize.UUID,
allowNull: true,
references: {
model: "collections",
},
});
await queryInterface.removeConstraint("integrations", "integrations_teamId_fkey")
await queryInterface.changeColumn("integrations", "teamId", {
type: Sequelize.UUID,
allowNull: false,
references: {
model: "teams",
},
});
}
};