Try our conversational search powered by Generative AI!

CMS upgrade scripts are not executed in case of setting updateDatabaseSchema as true

Found in

EPiServer.Commerce.8.13.0

Created

Jul 09, 2015

Updated

Aug 14, 2015

Area

Falcon/Commerce

State

Closed, Fixed and Tested


Steps to reproduce

TRIAGE NOTE: unlinked from versioning story since this can be reproduced on develop. The root causes are:

- The Commerce scripts are executed first, then CMS scripts. This is inconsistent with the manual update process. The best pratice is update CMS first, then Commerce.

- The CMS Schema updater get required version and DB version from Commerce DB, to decide if the CMS script should be executed or not. This is incorrect. CMS update script that Commerce team defines, does not check DB version to execute. Instead, it checks if the SP or the table exists or not to create it. Then CMS Schema updater should always return a value that allow CMS scripts to be executed always. And since the Commerce scripts are executed first, these CMS scripts never got executed, hence the bug.

 

Steps to reproduce

  1. Having Quanta site with Commerce nuget 8.13 installed
  2. Update Commerce nuget 8.13.4-feature-000731 on Quanta site project
  3. Enable update database schema automatically by adding updateDatabaseSchema="true" to the episerver.framework config (

    <episerver.framework updateDatabaseSchema="true">

    )
  4. Build and execute migration
    Expected: Migration complete successfully

    Actual: Get following exception on migration progress

Note: Migration works fine if execute update-epidatabase manually using cmdlet.

  • 11:37:30 AM: Completed migration step: Migrates most used draft: ready to publish, checked in and checked out draft
  • 11:37:30 AM: Migrates most used draft: ready to publish, checked in and checked out draft has failed with exception 'System.Data.SqlClient.SqlException (0x80131904): Could not find stored procedure 'tblProjectItem_MigrateWorkID'. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at EPiServer.Commerce.Internal.Migration.DraftStoreMigrator.UpdateWorkIdReferences(SqlTransaction transaction, IDictionary`2 workIdMapping) at EPiServer.Commerce.Internal.Migration.DraftStoreMigrator.Migrate(VersionStatus status, Int32& total) at EPiServer.Commerce.Internal.Migration.Steps.MigrateMostUsedDraftStep.Execute(IProgressMessenger progressMessenger) ClientConnectionId:8a7b6990-403b-4766-8972-e98e9939f26f Error Number:2812,State:1,Class:16'.
  • 11:37:29 AM: Migrating 'CheckedOut' drafts.
  • 11:37:29 AM: Starting migration step: Migrates most used draft: ready to publish, checked in and checked out draft
  • 11:37:28 AM: Completed migration step: Migrates published Catalog Content
  • 11:37:27 AM: Deleting stored procedure mdpsp_avto_CatalogEntryEx_Item_Update.
  • 11:37:27 AM: Deleting stored procedure mdpsp_avto_CatalogEntryEx_Item_Search.
  • 11:37:27 AM: Deleting stored procedure mdpsp_avto_CatalogEntryEx_Item_ListSpecificRecord