Tags: Optimizely/Episerver SQL

Is there really a RIGHT way to delete content directly in the Optimizely CMS database?

I stumped upon this blog post Delete a content – the right way by Optimizely employee, and all-time Optimizely World contribution star, Quan.

Quan refers to my name, and my blog post about how to manually delete content directly in the Optimizely CMS database using SQL statements, and claims that his way of deleting content using Optimizely's stored procedure is the right way. He does not explain why his way is the right way, he jumps right to the conclusion. This makes me wonder: who decides what's the right way of deleting content?

I do not necessarily agree with Quan here. Using a stored procedure with the ForceDelete flag without knowing how it's intended to be used or its inner workings could be risky!

With my approach, you'll see what tables are affected. And if any other tables reference the content you try to delete, you will (at least you should if Optimizely have control of their foreign keys) get a warning about violation of foreign key constraints and you may act accordingly. You may choose to update your SQL statement, or you might decide to abort.

If you want to learn the inner workings of the database, and have complete control, dig around, get familiar with all the tables, and write your own SQL statements! If you don't care, use the stored procedure! If you're smart use the edit interface, or IContentRepository from code.

If you decide to delete content «the correct way», with the stored procedure, at least read what it (and the other stored procedure it calls) does. You might learn something! 😁

Edit: Quans blog post has been updated, after he was made aware of this response.