CMS content not updated after SQL update

Gustavo Quevedo asked on December 9, 2019 16:29

Hi,

I'm working on a Kentico 12 SP1 MVC site deployed on a two-server web farm.

I have a content-only page type with hundreds of records where I had to make a change on the database level (SQL replace update on a particular field).

This changes is reflected on the site. However I can't get the change reflected in the CMS interface, so users overwrite it when editing the records.

I've tried to restart IIS, all applications, clear the cache on the system application and no luck. Where is the CMS reading the old value from? Is there a cache or anything else somewhere that I need to restart?

Thanks in advance.

Kind regards,

Gustavo

Correct Answer

Trevor Fayas answered on December 9, 2019 16:34

You probably have versioning.

It is not recommended making changes to Kentico through SQL updates, as none of this is tracked by Kentico's event system, which handles things such as cache clearing, version control, staging task and event log tracking, and any integrations.

Kentico has the main table, but also has a Versioning table, when changes are made, it updates the current version, and if it's 'published' then it updates the main tables as well. Your editing interface is probably looking at the un-updated version table, which doesn't have your changes, and when they save it overwrites the sql-updated other content.

Highly recommended redoing your update procedure to use Kentico API. You can try to update the Version table as well, but it's serialized XML...so you may not have fun with that.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Gustavo Quevedo answered on December 9, 2019 16:44

Trevor,

That's it. I forgot about versioning.

Thank you for your detailed answer. Much appreciated.

Kind regards,

Gustavo

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on December 9, 2019 16:47

To be more specific to Trevors answer, there are 3 things you need to look at:

  • Page content
  • Workflow
  • Versioning

If you have workflow or versioning turned on, you not only need to update the pages content in the single table, you also need to make sure the page is not checked out and update the versioning table too (not an easy SQL task to do).

You have a few options to fix this.

  • Turn workflow and version history off for that secific section of your site. This can be done in the Workflow app and Settings. After you turn it off, then do the update to the content table. After you've done your update to the table, turn workflow and versioning back on and add the pages to workflow so they get a version behind them.
  • Write some code to do a mass update or update the values manually. Here are the API examples on how to properly handle pages using the API.
1 votesVote for this answer Mark as a Correct answer

Gustavo Quevedo answered on December 9, 2019 16:55

I see. All makes sense now.

Thank you Brenden!

0 votesVote for this answer Mark as a Correct answer

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