perf: Add subscriptions documentId index for document delete cascade (#14688)

This commit is contained in:
Tom Moor authored and GitHub committed 2026-11-23 09:20:27 -05:00
1 parent 5935d4de3e
commit 6576bc832a
1 file changed
+17
@@ -0,0 +1,17 @@
"use strict";
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface) {
// Covers the foreign key cascade when a document is permanently deleted.
await queryInterface.sequelize.query(
'CREATE INDEX CONCURRENTLY IF NOT EXISTS "subscriptions_document_id" ON "subscriptions" ("documentId");'
);
},
async down(queryInterface) {
await queryInterface.sequelize.query(
'DROP INDEX CONCURRENTLY IF EXISTS "subscriptions_document_id";'
);
},
};