chore: Add missing constraints to comments table

This commit is contained in:
Tom Moor committed 2024-01-23 20:01:20 -05:00
1 parent bc8697acdf
commit e0995bfcb4
1 file changed
+41
@@ -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",
},
});
}
};