Remove all versions of datas

Monjoie Dominique asked on December 8, 2017 10:45

Hello,

Every year, I have an action with around 200 events. In my page type, there is a multichoice field with the possibles dates of an event.

I use an UPDATE to empty the values in this field. I check with a SELECT and all is blank. When I return to the CMS, I see the values still clicked in the multichoice.

I see that there is a table VersionHistory. Can I do something like 'DELETE * FROM VersionHistory WHERE NodePathAlias LIKE %path/XXX%' to remove all the old versions of my datas ?

In advance, Thanks.

Recent Answers


Trevor Fayas answered on December 8, 2017 17:40

I'm guessing you have workflow turned on, correct? Because if so, when you make an update, you do need to do special code to update the current version of the document, Kentico provides API examples that will help you do the right type of update.

https://docs.kentico.com/api10/content-management/pages#Pages-Updatingthelatesteditedversionofpages(pagesunderworkflow)

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on December 8, 2017 19:53

Updating data directly in the database, especially page data, is not recommended at all. Since you're using versioning, your best bet is to use the API to perform that update/deletion of records. I'd create a module or a webpart which will allow you to select a path or an individual page and perform the actions you need. This will have much better results than doing it manually.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.