Files
outline/server/migrations/20260514000000-cascade-resolved-to-reply-comments.js
T
Tom Moor a5c22bbb09 feat(mcp): Add commentCount to document info response (#12355)
* Add commentsCount to MCP document info response

* fix: refine MCP document comment counts
2026-05-16 08:42:48 -04:00

21 lines
592 B
JavaScript

"use strict";
module.exports = {
async up(queryInterface) {
await queryInterface.sequelize.query(`
UPDATE comments AS reply
SET "resolvedAt" = parent."resolvedAt",
"resolvedById" = parent."resolvedById"
FROM comments AS parent
WHERE reply."parentCommentId" = parent.id
AND parent."resolvedAt" IS NOT NULL
AND reply."resolvedAt" IS NULL;
`);
},
async down() {
// No-op: the inherited resolved state on replies is now load-bearing for
// the unresolved commentCount counter cache, so it cannot safely be undone.
},
};