Files
outline/server/migrations/20260224021319-add-subscription-event-indexes.js
T
Tom Moor ff6a20ef38 perf: Slow query in NotificationHelper (#11534)
* perf: Slow query in NotificationHelper

* Create index concurrently
2026-02-23 21:31:52 -05:00

31 lines
847 B
JavaScript

"use strict";
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.addIndex("subscriptions", ["event", "documentId"], {
name: "subscriptions_event_document_id",
where: { deletedAt: null },
concurrently: true,
});
await queryInterface.addIndex("subscriptions", ["event", "collectionId"], {
name: "subscriptions_event_collection_id",
where: { deletedAt: null },
concurrently: true,
});
},
async down(queryInterface, Sequelize) {
await queryInterface.removeIndex(
"subscriptions",
"subscriptions_event_document_id",
{ concurrently: true }
);
await queryInterface.removeIndex(
"subscriptions",
"subscriptions_event_collection_id",
{ concurrently: true }
);
},
};