chore: Add missing constraints to comments table

This commit is contained in:
Tom Moor
2024-01-21 12:35:57 -05:00
parent 4ddb5c3eed
commit 4f74fe03dd

View File

@@ -0,0 +1,41 @@
'use strict';
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.removeConstraint("comments", "comments_createdById_fkey")
await queryInterface.changeColumn("comments", "createdById", {
type: Sequelize.UUID,
onDelete: "cascade",
references: {
model: "users",
},
});
await queryInterface.removeConstraint("comments", "comments_resolvedById_fkey")
await queryInterface.changeColumn("comments", "resolvedById", {
type: Sequelize.UUID,
onDelete: "set null",
references: {
model: "users",
},
});
},
down: async (queryInterface, Sequelize) => {
await queryInterface.removeConstraint("comments", "comments_resolvedById_fkey")
await queryInterface.changeColumn("comments", "resolvedById", {
type: Sequelize.UUID,
references: {
model: "users",
},
});
await queryInterface.removeConstraint("comments", "comments_createdById_fkey")
await queryInterface.changeColumn("comments", "createdById", {
type: Sequelize.UUID,
references: {
model: "users",
},
});
}
};