We're trying to upgrade our project from CMS 8.11 and Commerce 8.16 to CMS/Commerce 9.4. We've downloaded the NuGet packages and been able to build the solution successfully.
However, when we run the 'update-epidatabase' cmdlet we get an error.
The cmdlet is able to process the sql scripts in the 'EPiServer.CMS.Core.9.4.0' folder, but in the 'EPiServer.Commerce.Core.9.4.0' folder it stops at the file '126.96.36.199.sql' and throws an SqlException:
The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK_OrderGroupNote_OrderGroup". The conflict occurred in database "", table "dbo.OrderGroup", column 'OrderGroupId'.
Does anyone have any idea what the problem is, or how we can debug it further? Setting the -Verbose flag to true on the cmdlet doesn't give us anything helpful.
We're aware of this issue and I can say it was my fault. Upcoming version will fix this, but right now you can open this file:packages\EPiServer.Commerce.Core.9.4.0\tools\epiupdates_commerce\sql\188.8.131.52.sql and edit this
--Delete orphaned notesDELETE n FROM dbo.OrderGroupNote n LEFT JOIN dbo.OrderGroup g ON n.OrderGroupId = g.OrderGroupId WHERE n.OrderGroupId IS NULL
to be this
--Delete orphaned notesDELETE n FROM dbo.OrderGroupNote n LEFT JOIN dbo.OrderGroup g ON n.OrderGroupId = g.OrderGroupId WHERE g.OrderGroupId IS NULL
Save it and now update-epidatabase would work fine.
Apologies for your inconvenience.
Thanks, that solved it!
We encountered a new issue thought, but there's already another forum thread for that: http://world.episerver.com/forum/developer-forum/EPiServer-Commerce/Thread-Container/2015/11/upgrade-mediachase_ecf50_mdp_key-error/