perf: Improve collab persistence performance (#4544)

* stash

* Remove query of state in documentCollaborativeUpdater
This commit is contained in:
Tom Moor
2022-12-06 05:21:10 -08:00
committed by GitHub
parent b0b7c7d647
commit 98d79e1e8b
2 changed files with 29 additions and 19 deletions

View File

@@ -3,6 +3,7 @@ import { compact, uniq } from "lodash";
import randomstring from "randomstring";
import type { SaveOptions } from "sequelize";
import {
Sequelize,
Transaction,
Op,
FindOptions,
@@ -116,6 +117,17 @@ export const DOCUMENT_VERSION = 2;
},
],
},
withStateIsEmpty: {
attributes: {
exclude: ["state"],
include: [
[
Sequelize.literal(`CASE WHEN state IS NULL THEN true ELSE false END`),
"stateIsEmpty",
],
],
},
},
withState: {
attributes: {
// resets to include the state column