Content Version Cleanup
A new version is created whenever you save and publish a content item in Umbraco. This is how you can roll back to a previous version. Every saved version stores a record in the database, not only for the version but also for each content item property for that version. In a multi-lingual site, further rows are added for every culture variation. Over time this amount of data can build and swallow up the capacity of your SQL Server and slow the performance of the Umbraco backoffice.
How it works
The default cleanup policy will:
Not delete any versions created over the previous 4 days. The recent version history is preserved. See the
KeepAllVersionsNewerThanDays
setting.'Prune' versions 4 days after they are created. The last version of a content item saved on a particular day will be kept but earlier versions from that day will be deleted.
Delete all versions older than 90 days. See the
KeepLatestVersionPerDayForDays
setting.Never delete any versions that are currently 'published'.
Never delete any specific versions marked as 'Prevent Cleanup' in the Backoffice version history.
Based on the default cleanup policy, you can roll back content to the latest version saved on a particular day as long as it was
Created within the last 90 days, or
Marked as "Prevent Cleanup" in the Backoffice version history.
The History section, which acts as an audit log, is not cleared out, and will continue to show logs for versions older than 90 days.
The feature can be configured in the appSettings.json
:
For sites with stricter requirements, it is possible to opt-out of both options globally, see ContentSettings and by Document Type.
Additionally, it is possible to keep the feature enabled but mark specific versions to keep forever.
It is worth noting that whilst we delete rows, we do not shrink database files or rebuild indexes. For upgraded sites with a lot of history you may wish to perform these tasks. If they are not part of your regular database maintenance plan already.
Overriding global settings
It is possible to override the global settings per Document Type in the backoffice to prevent unwanted cleanup. This can be managed in the "permissions" Content App for each Document Type.
![Content Version Cleanup - Document Type overrides](https://docs.umbraco.com/~gitbook/image?url=https%3A%2F%2F3701346516-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FG1Byxw7XfiZAj8zDMCTD%252Fuploads%252FgrIqvkFcOkEYUcpFt9IV%252Fimage.png%3Falt%3Dmedia%26token%3Dc9c9dfd4-d2f8-417c-9f14-adbf79bb9199&width=768&dpr=4&quality=100&sign=25830a50&sv=1)
Prevent cleanup of important versions
It is possible to mark important content versions as "prevent cleanup" to ensure they are never removed. This happens via the new and improved rollback modal which can be found on the "info" content app for each document.
Open rollback modal.
Click Prevent cleanup button for each important version.
Last updated