26 lines
617 B
JavaScript
26 lines
617 B
JavaScript
"use strict";
|
|
|
|
module.exports = {
|
|
up: async (queryInterface, Sequelize) => {
|
|
// Add foreign key constraint for acceptedAnswerId
|
|
await queryInterface.addConstraint("ForumPosts", {
|
|
fields: ["acceptedAnswerId"],
|
|
type: "foreign key",
|
|
name: "ForumPosts_acceptedAnswerId_fkey",
|
|
references: {
|
|
table: "ForumComments",
|
|
field: "id",
|
|
},
|
|
onDelete: "SET NULL",
|
|
onUpdate: "CASCADE",
|
|
});
|
|
},
|
|
|
|
down: async (queryInterface, Sequelize) => {
|
|
await queryInterface.removeConstraint(
|
|
"ForumPosts",
|
|
"ForumPosts_acceptedAnswerId_fkey"
|
|
);
|
|
},
|
|
};
|