Checking your infoset data consistency after upgrading from 1.x to 1.8+

Database, Advanced, Upgrade, InfoSet, Orchard 1.x, Orchard 1.8, Query

Many Orchard developers, including ourselves act as early adopters of the Orchard source and use the code from the 1.x and other work-in-progress branches. While it gives us the opportunity to try the new features and get the latest bugfixes, some changes introduce important bugs every now and then. That was the case lately on the 1.x branch, when a problem surfaced regarding the infoset storage: for shifted, versionable content parts the infoset data was not saved in the ContentItemVersionRecord table, but into the ContentItemRecord table instead. Sébastien discovered this issue before 1.8 release and provided a method to fix it, along with a well-detailed description on the Orchard discussion board.

At this moment, we are in the middle of upgrading all our sites to Orchard 1.8+ (+ means we are running 1.x, of course) and after careful testing in our local and staging environments we'll soon hit the big red button to make it go live: every Lombiq-related website will run on the latest source, that includes every DotNest tenant too!

While upgrading your sites and testing the fix for the infoset storage, you may need to check if your data was really restored to its desired state, so here's a little help: below is an SQL-script that you can run against your DB, which checks if there's any corrupted infoset entry left, so you can verify if the upgrade mechanism worked.

USE [MyDatabase]
GO

SELECT Item.Id AS ItemId, VersionItem.Id AS VersionItemId
  FROM [dbo].[MyPrefix_Orchard_Framework_ContentItemRecord] AS Item
  INNER JOIN [dbo].[MyPrefix_Orchard_Framework_ContentItemVersionRecord] AS VersionItem
  ON Item.Id = VersionItem.ContentItemRecord_id
  WHERE VersionItem.Latest = 1 AND VersionItem.Data IS NULL AND Item.Data IS NOT NULL
  ORDER BY Item.Id
GO

Happy upgrading!

2 Comments

  • Josh said Reply

    Thanks for sharing this script! We were in the same boat with running a site off 1.x and this script definitely gave us more confidence that the all the data was restored properly.

Add a Comment