I've been working on a site for a while in beta. The number of versions for all the pages is getting big and the database is now over 2MB. I'd love to just delete all the old versions of all pages when I go live with the site. Is there any easy way to do this?

5 Answers 5


I just wrote a plugin that deletes all versions (truncates the craft_entryversions table) and then saves a new version for each of your entries, so you can later revert back to it:

Delete All Entry Versions


EDIT: This is the only answer for Craft 3! All other answers refer to solutions in Craft 2.

The question is very old, but maybe in 2020 somebody still finds it. Nowadays you can just ./craft utils/prune-revisions

  • Hey, thanks a lot for this! I wanted to cleanup the revisions without going into sql every time, so in the end had set the max revisions to a low number to keep the entries low. But then we were missing the revisions. This solution way better! :)
    – Friksel
    Commented Apr 20, 2020 at 17:31
  • As much as I love carlcs' work and plugin - this should be the right answer @bperdue Commented Nov 18, 2020 at 11:41

I have a site with quite a lot of traffic and user submissions. After a while DB backups started taking too long (uncompressed sql dump over 300mb).

Instead of keeping the last change, I now keep 30 days worth of changes. I have a cron job set up to remove older revisions.

mysql -e 'DELETE FROM craft_entryversions WHERE dateUpdated < DATE_SUB(NOW(),INTERVAL 30 DAY)' dbname

If you don't need revisions for certain sections, just disable revisions altogether on a per section basis.

I hope this helps other people with large craft_entryversions tables.


You should be able to just safely delete them from the craft_entryversions table.

Obviously this deletes all your entry versions, so each entry will just exist at its last known 'live' state.

Also, backup your database first. :)

  • 2
    +1 for "backup your database first"
    – Lindsey D
    Commented Jul 23, 2015 at 5:02
  • There's one problem with this approach. You're also deleting the current versions with this, so you won't be able to revert to them once edits are made and saved. To solve this, open each entry and resave it (something you would better do with a custom plugin!!).
    – carlcs
    Commented Jul 23, 2015 at 5:49

Just to add to this, you can easily remove previous versions of files (except the current/most recent) with the following SQL query:

DELETE FROM craft_entryversions WHERE id NOT IN (SELECT id FROM (SELECT max(id), entryId FROM craft_entryversions GROUP BY entryId) X);

Obviously backup the old database/table first!

  • This is NOT a good idea, current version != last added version.
    – carlcs
    Commented Nov 30, 2015 at 17:12
  • Obviously a sledgehammer but in pre-launch instances where versioning isn't really being used yet this has proven a good way to clear out a bloated database of entries! Commented Nov 30, 2015 at 17:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.