diff --git a/migrations/1727852225583_scenario-foreing-keys.js b/migrations/1727852225583_scenario-foreing-keys.js new file mode 100644 index 0000000..f85bf32 --- /dev/null +++ b/migrations/1727852225583_scenario-foreing-keys.js @@ -0,0 +1,24 @@ + +exports.up = (pgm) => { + pgm.dropConstraint({ schema: "jtl", name: "notifications" }, "notifications_scenario_id_fkey") + pgm.addConstraint({ schema: "jtl", name: "notifications" }, "notifications_scenario_id_fkey", { + foreignKeys: { + columns: "scenario_id", + references: { + schema: "jtl", name: "scenario", column: "id", + }, + onDelete: "CASCADE", + }, + }) + pgm.dropConstraint({ schema: "jtl", name: "scenario_share_tokens" }, "scenario_share_tokens_scenario_id_fkey") + pgm.addConstraint({ schema: "jtl", name: "scenario_share_tokens" }, "scenario_share_tokens_scenario_id_fkey", { + foreignKeys: { + columns: "scenario_id", + references: { + schema: "jtl", name: "scenario", column: "id", + }, + onDelete: "CASCADE", + }, + }) + +}