migration files
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
"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"
|
||||
);
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user