grist-core
grist-core copied to clipboard
Rest API endpoint to purge history of a document
Documents can get huge, mostly because of the history. This can lead to difficulties to open documents.
User-Story: As a document owner, I would like to purge or reduce the size of the history of a document in order to ease the document opening or to shrink the disk / storage usage for this document.
NB: there is a companion tool to purge the history: https://github.com/gristlabs/grist-core/blob/c0ce791e285f6153a38f030bdc98e04eeb3971c8/app/server/companion.ts#L55-L67
However:
- it is only available to the administrator hosting the Grist instance;
- it's unclear whether the tool can be used in the context of multi-worker instance, with S3 storage backend;
There is also a /states/remove endpoint, not documented. You can see it being exercised here:
https://github.com/gristlabs/grist-core/blob/91e0a62e9127c44bea394ee007b0def30e3e38f1/test/server/lib/DocApi.ts#L3217-L3241
Thanks @paulfitz!
To fix this issue, I tend to think we may just document this API as well as GET /states/.
There could also be an enhancement to offer an option which limits the history size in another issue (so the docs don't get huge). WDYT?