Ctrl K
ComunidadGuías…

server/migrations/20260107220000-add-access-request-to-notifications.js

Rama main · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
"use strict";

/** @type {import('sequelize-cli').Migration} */
module.exports = {
  async up(queryInterface, Sequelize) {
    await queryInterface.addColumn("notifications", "accessRequestId", {
      type: Sequelize.UUID,
      allowNull: true,
      references: {
        model: "access_requests",
        key: "id",
      },
      onDelete: "SET NULL",
      onUpdate: "CASCADE",
    });

    await queryInterface.addIndex("notifications", ["accessRequestId"]);
  },

  async down(queryInterface) {
    await queryInterface.removeIndex("notifications", ["accessRequestId"]);
    await queryInterface.removeColumn("notifications", "accessRequestId");
  },
};