Delete all content history
# help-with-umbraco
o
Hi all, Does anyone know of the best way to delete all content history? We've tried setting content version cleanup policy like this:
Copy code
json
"ContentVersionCleanupPolicy": {
  "EnableCleanup": true,
  "KeepLatestVersionPerDayForDays": 0,
  "KeepAllVersionsNewerThanDays": 0
},
but that didn't seem to work, I can see that it did delete a handful of content versions but there is still a good few years worth of history still there.
n
Well.... the easiest way is to use uSync complete/Content edition to export everything and then import it all into a clean DB 🙂 But, typically I think you'd end up using DB scripts to do it.
s
IIRC correctly the content version cleanup policy is only used to determine which versions to keep, when new versions are added (eg. when publishing a page). So you could run through all pages an publish them 🙃
h
My thoughts too
o
Ahh I see, huh, for some reason I was assuming content cleanup was a background task that just ran every night... no clue why I thought that! Yea I'll likely go down the sql route as I have 200k+ nodes 😬 I'll post the sql here, once I make it, for future reference Cheers all
Wait, it is a background job! It runs every hour: https://github.com/umbraco/Umbraco-CMS/blob/v13/dev/src/Umbraco.Infrastructure/BackgroundJobs/Jobs/ContentVersionCleanupJob.cs Hmm, gonna dig into this to see why it isn't deleting everything
32 Views