Delete old version of content item

Topics: Administration
Feb 23, 2013 at 11:00 AM
Edited Feb 23, 2013 at 12:03 PM
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.
Developer
Feb 23, 2013 at 9: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.
Coordinator
Feb 23, 2013 at 9:56 PM
How about unchecking "draftable" in the content type editor?
Developer
Feb 24, 2013 at 5:53 PM
That will still generate version records.
Coordinator
Feb 24, 2013 at 6:03 PM
Ah, I see. How is that a problem?
Feb 24, 2013 at 6: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
Coordinator
Feb 24, 2013 at 7: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 7: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 ?
Coordinator
Feb 25, 2013 at 9:19 AM
Define small.
Feb 26, 2013 at 8:39 AM
3 objects ?
Coordinator
Feb 26, 2013 at 8:41 AM
Then no.