Delete old version of content item

Topics: Administration
Feb 23, 2013 at 10:00 AM
Edited Feb 23, 2013 at 11:03 AM
I would like to have only one version for each content item.
How can i delete old version content item and leave only last version.

Now i have 3194 number of row in Orchard_Framework_ContentItemRecord table and 9339 number of row in Orchard_Framework_ContentItemVersionRecord table.

Also, I would like to delete from the database all remoted content item.
Feb 23, 2013 at 8:02 PM
I think you would have to write your own AdminController for editing content items so that you can invoke the content manager without the VersionOptions.DraftRequired option (because that option will create a draft for you).

To delete records permanently, either inject an IRepository<T> or use the ISession directly.
Feb 23, 2013 at 8:56 PM
How about unchecking "draftable" in the content type editor?
Feb 24, 2013 at 4:53 PM
That will still generate version records.
Feb 24, 2013 at 5:03 PM
Ah, I see. How is that a problem?
Feb 24, 2013 at 5:34 PM
database takes up too much space
backup database takes up too much space
backup database takes up more hardware resources
maybe the site is slower
Feb 24, 2013 at 6:05 PM
How much space does the database take? Did you measure a slowdown?

Quite a few people have been asking for some sort of cleanup procedure, but it's not completely clear what the benefits would be, and nobody has needed it badly enough that they would spend the time to actually build a module for it.

If you want to build it, we'll help you figure out what can be safely done to the DB in order to achieve your goals.
Feb 25, 2013 at 6:36 AM
I agree wth this Clean up process need,(may be using workflow -better) on any Cloud you pay for storage and don't want to keep old versions.
Is Orchard reserved for 'small' projects ?
Feb 25, 2013 at 8:19 AM
Define small.
Feb 26, 2013 at 7:39 AM
3 objects ?
Feb 26, 2013 at 7:41 AM
Then no.