Upgrade 7.17.7 -> 8.2.3: Invalid column name 'versionId'
Hi,
We're having quite a frustrating time trying to upgrade Umbraco 7 to a later version, and I'm hoping someone can provide a bit of insight.
We are following the directions to migrate from v. 7.17.7 to 8.2.3 (we're on our way to 9+, but I gathered from much documentation that taking it in smaller steps is preferable).
Data conversion starts as expected, and things look good i the log. After a long time (20+ hours), we get a failure "Invalid column name 'versionId'" in the logs. The log file doesn't state on which table, but comparing the logs with the source code, I suspect that the error occurs on line 250 of VariantsMigration.cs:
// drop more columns
Delete.Column("versionId").FromTable(PreTables.ContentVersion).Do();
cmsContentVersion does contain the versionId column before initiating the upgrade, and I see nothing in the logs to indicate that the column has been changed before this failure.
This is not due to database timeout. We have had a go at this using several different set-ups, and while the upgrade time can vary, the point at which it fails is consistent.
The last lines of the log file are below (...following tables were found in the database, but are not in the current schema... message truncated):
{"@t":"2022-06-29T11:44:20.7032511Z","@mt":"SQL [{ContextIndex}]: {Sql}","ContextIndex":77167,"Sql":"ALTER TABLE [cmsDocument] DROP COLUMN [versionId];","SourceContext":"Umbraco.Core.Migrations.Expressions.Delete.Expressions.DeleteColumnExpression","ProcessId":10644,"ProcessName":"iisexpress","ThreadId":16,"AppDomainId":3,"AppDomainAppId":"LMW3SVC5ROOT","MachineName":"PC34-T15P","Log4NetLevel":"INFO ","HttpRequestNumber":7,"HttpRequestId":"8d51a625-2f05-45dd-b7b1-31039c59f820"}
{"@t":"2022-06-29T11:44:20.7022467Z","@mt":"SQL [{ContextIndex}]: {Sql}","ContextIndex":77166,"Sql":"ALTER TABLE [cmsDocument] DROP COLUMN [updateDate];","SourceContext":"Umbraco.Core.Migrations.Expressions.Delete.Expressions.DeleteColumnExpression","ProcessId":10644,"ProcessName":"iisexpress","ThreadId":16,"AppDomainId":3,"AppDomainAppId":"LMW3SVC5ROOT","MachineName":"PC34-T15P","Log4NetLevel":"INFO ","HttpRequestNumber":7,"HttpRequestId":"8d51a625-2f05-45dd-b7b1-31039c59f820"}
{"@t":"2022-06-29T11:44:20.7056238Z","@mt":"SQL [{ContextIndex}]: {Sql}","ContextIndex":77168,"Sql":"ALTER TABLE [cmsDocument] DROP CONSTRAINT [DF__cmsDocume__newes__0E240DFC]","SourceContext":"Umbraco.Core.Migrations.Expressions.Delete.Expressions.DeleteDefaultConstraintExpression","ProcessId":10644,"ProcessName":"iisexpress","ThreadId":16,"AppDomainId":3,"AppDomainAppId":"LMW3SVC5ROOT","MachineName":"PC34-T15P","Log4NetLevel":"INFO ","HttpRequestNumber":7,"HttpRequestId":"8d51a625-2f05-45dd-b7b1-31039c59f820"}
{"@t":"2022-06-29T11:44:20.7066111Z","@mt":"SQL [{ContextIndex}]: {Sql}","ContextIndex":77169,"Sql":"ALTER TABLE [cmsDocument] DROP COLUMN [newest];","SourceContext":"Umbraco.Core.Migrations.Expressions.Delete.Expressions.DeleteColumnExpression","ProcessId":10644,"ProcessName":"iisexpress","ThreadId":16,"AppDomainId":3,"AppDomainAppId":"LMW3SVC5ROOT","MachineName":"PC34-T15P","Log4NetLevel":"INFO ","HttpRequestNumber":7,"HttpRequestId":"8d51a625-2f05-45dd-b7b1-31039c59f820"}
{"@t":"2022-06-29T11:44:20.7473328Z","@mt":"SQL [{ContextIndex}]: {Sql}","ContextIndex":77170,"Sql":"ALTER TABLE [cmsDocument] ADD [edited] BIT NULL ","SourceContext":"Umbraco.Core.Migrations.Expressions.Execute.Expressions.ExecuteSqlStatementExpression","ProcessId":10644,"ProcessName":"iisexpress","ThreadId":16,"AppDomainId":3,"AppDomainAppId":"LMW3SVC5ROOT","MachineName":"PC34-T15P","Log4NetLevel":"INFO ","HttpRequestNumber":7,"HttpRequestId":"8d51a625-2f05-45dd-b7b1-31039c59f820"}
{"@t":"2022-06-29T11:53:09.0712936Z","@mt":"Exception ({InstanceId}).","@l":"Error","@x":"System.Data.SqlClient.SqlException (0x80131904): Invalid column name 'versionId'.\r\n at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)\r\n at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)\r\n at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)\r\n at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)\r\n at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)\r\n at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)\r\n at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()\r\n at StackExchange.Profiling.Data.ProfiledDbCommand.ExecuteNonQuery() in C:\\projects\\dotnet\\src\\MiniProfiler.Shared\\Data\\ProfiledDbCommand.cs:line 272\r\n at Umbraco.Core.Persistence.FaultHandling.FaultHandlingDbCommand.<ExecuteNonQuery>b__31_0() in D:\\a\\1\\s\\src\\Umbraco.Core\\Persistence\\FaultHandling\\RetryDbConnection.cs:line 209\r\n at Umbraco.Core.Persistence.FaultHandling.FaultHandlingDbCommand.<>c__DisplayClass33_0`1.<Execute>b__0() in D:\\a\\1\\s\\src\\Umbraco.Core\\Persistence\\FaultHandling\\RetryDbConnection.cs:line 222\r\n at Umbraco.Core.Persistence.FaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func) in D:\\a\\1\\s\\src\\Umbraco.Core\\Persistence\\FaultHandling\\RetryPolicy.cs:line 172\r\n at Umbraco.Core.Persistence.FaultHandling.FaultHandlingDbCommand.Execute[T](Func`1 f) in D:\\a\\1\\s\\src\\Umbraco.Core\\Persistence\\FaultHandling\\RetryDbConnection.cs:line 219\r\n at Umbraco.Core.Persistence.FaultHandling.FaultHandlingDbCommand.ExecuteNonQuery() in D:\\a\\1\\s\\src\\Umbraco.Core\\Persistence\\FaultHandling\\RetryDbConnection.cs:line 209\r\n at NPoco.Database.ExecuteNonQueryHelper(DbCommand cmd)\r\n at NPoco.Database.NPoco.IDatabaseHelpers.ExecuteNonQueryHelper(DbCommand cmd)\r\n at NPoco.Database.Execute(String sql, CommandType commandType, Object[] args)\r\nClientConnectionId:b03ea0c4-46f0-4033-8edb-a2e530323166\r\nError Number:207,State:1,Class:16","InstanceId":"3698490f","SourceContext":"Umbraco.Core.Persistence.UmbracoDatabase","ProcessId":10644,"ProcessName":"iisexpress","ThreadId":16,"AppDomainId":3,"AppDomainAppId":"LMW3SVC5ROOT","MachineName":"PC34-T15P","Log4NetLevel":"ERROR","HttpRequestNumber":7,"HttpRequestId":"8d51a625-2f05-45dd-b7b1-31039c59f820"}
{"@t":"2022-06-29T11:53:09.4014448Z","@mt":"Database configuration failed","@l":"Error","@x":"System.Data.SqlClient.SqlException (0x80131904): Invalid column name 'versionId'.\r\n at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)\r\n at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)\r\n at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)\r\n at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)\r\n at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)\r\n at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)\r\n at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()\r\n at StackExchange.Profiling.Data.ProfiledDbCommand.ExecuteNonQuery() in C:\\projects\\dotnet\\src\\MiniProfiler.Shared\\Data\\ProfiledDbCommand.cs:line 272\r\n at Umbraco.Core.Persistence.FaultHandling.FaultHandlingDbCommand.<ExecuteNonQuery>b__31_0() in D:\\a\\1\\s\\src\\Umbraco.Core\\Persistence\\FaultHandling\\RetryDbConnection.cs:line 209\r\n at Umbraco.Core.Persistence.FaultHandling.FaultHandlingDbCommand.<>c__DisplayClass33_0`1.<Execute>b__0() in D:\\a\\1\\s\\src\\Umbraco.Core\\Persistence\\FaultHandling\\RetryDbConnection.cs:line 222\r\n at Umbraco.Core.Persistence.FaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func) in D:\\a\\1\\s\\src\\Umbraco.Core\\Persistence\\FaultHandling\\RetryPolicy.cs:line 172\r\n at Umbraco.Core.Persistence.FaultHandling.FaultHandlingDbCommand.Execute[T](Func`1 f) in D:\\a\\1\\s\\src\\Umbraco.Core\\Persistence\\FaultHandling\\RetryDbConnection.cs:line 219\r\n at Umbraco.Core.Persistence.FaultHandling.FaultHandlingDbCommand.ExecuteNonQuery() in D:\\a\\1\\s\\src\\Umbraco.Core\\Persistence\\FaultHandling\\RetryDbConnection.cs:line 209\r\n at NPoco.Database.ExecuteNonQueryHelper(DbCommand cmd)\r\n at NPoco.Database.NPoco.IDatabaseHelpers.ExecuteNonQueryHelper(DbCommand cmd)\r\n at NPoco.Database.Execute(String sql, CommandType commandType, Object[] args)\r\n at NPoco.Database.Execute(Sql Sql)\r\n at NPoco.Database.Execute(String sql, Object[] args)\r\n at Umbraco.Core.Migrations.Upgrade.V_8_0_0.VariantsMigration.MigrateVersions() in D:\\a\\1\\s\\src\\Umbraco.Core\\Migrations\\Upgrade\\V_8_0_0\\VariantsMigration.cs:line 225\r\n at Umbraco.Core.Migrations.Upgrade.V_8_0_0.VariantsMigration.Migrate() in D:\\a\\1\\s\\src\\Umbraco.Core\\Migrations\\Upgrade\\V_8_0_0\\VariantsMigration.cs:line 24\r\n at Umbraco.Core.Migrations.MigrationBase.Umbraco.Core.Migrations.IMigration.Migrate() in D:\\a\\1\\s\\src\\Umbraco.Core\\Migrations\\MigrationBase.cs:line 73\r\n at Umbraco.Core.Migrations.MigrationPlan.Execute(IScope scope, String fromState, IMigrationBuilder migrationBuilder, ILogger logger) in D:\\a\\1\\s\\src\\Umbraco.Core\\Migrations\\MigrationPlan.cs:line 309\r\n at Umbraco.Core.Migrations.Upgrade.Upgrader.Execute(IScopeProvider scopeProvider, IMigrationBuilder migrationBuilder, IKeyValueService keyValueService, ILogger logger) in D:\\a\\1\\s\\src\\Umbraco.Core\\Migrations\\Upgrade\\Upgrader.cs:line 67\r\n at Umbraco.Core.Migrations.Install.DatabaseBuilder.UpgradeSchemaAndData(MigrationPlan plan) in D:\\a\\1\\s\\src\\Umbraco.Core\\Migrations\\Install\\DatabaseBuilder.cs:line 498\r\nClientConnectionId:b03ea0c4-46f0-4033-8edb-a2e530323166\r\nError Number:207,State:1,Class:16","SourceContext":"Umbraco.Core.Migrations.Install.DatabaseBuilder","ProcessId":10644,"ProcessName":"iisexpress","ThreadId":16,"AppDomainId":3,"AppDomainAppId":"LMW3SVC5ROOT","MachineName":"PC34-T15P","Log4NetLevel":"ERROR","HttpRequestNumber":7,"HttpRequestId":"8d51a625-2f05-45dd-b7b1-31039c59f820"}
{"@t":"2022-06-29T11:53:09.4044364Z","@mt":"The database schema validation produced the following summary: {DbSchemaSummary}","DbSchemaSummary":"The following tables were found in the database, but are not in the current schema:\r\ncmsContent,cmsContentVersion,cmsContentXml,cmsContentXml_bak,cmsDataType,cmsDataTypePreValues,cmsDocument,cmsMedia,cmsPreviewXml,cmsPropertyData,cmsTask,cmsTaskType,umbracoDomains, ... ,IX_cmsTags_LanguageId,IX_umbracoUserLogin_lastValidatedUtc,IX_umbracoContentVersionCultureVariation_VersionId,IX_umbracoContentVersionCultureVariation_LanguageId,IX_umbracoDocumentCultureVariation_NodeId,IX_umbracoDocumentCultureVariation_LanguageId\r\n \r\n","SourceContext":"Umbraco.Core.Migrations.Install.DatabaseBuilder","ProcessId":10644,"ProcessName":"iisexpress","ThreadId":16,"AppDomainId":3,"AppDomainAppId":"LMW3SVC5ROOT","MachineName":"PC34-T15P","Log4NetLevel":"INFO ","HttpRequestNumber":7,"HttpRequestId":"8d51a625-2f05-45dd-b7b1-31039c59f820"}
{"@t":"2022-06-29T11:53:09.4809691Z","@mt":"Installation step {Step} failed.","@l":"Error","@x":"System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Umbraco.Web.Install.InstallException: The database failed to upgrade. ERROR: The database configuration failed with the following message: Invalid column name 'versionId'.\n Please check log file for additional information (can be found in '/App_Data/Logs/')\r\n at Umbraco.Web.Install.InstallSteps.DatabaseUpgradeStep.ExecuteAsync(Object model) in D:\\a\\1\\s\\src\\Umbraco.Web\\Install\\InstallSteps\\DatabaseUpgradeStep.cs:line 47\r\n --- End of inner exception stack trace ---\r\n at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)\r\n at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)\r\n at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)\r\n at Umbraco.Web.Install.Controllers.InstallApiController.<ExecuteStepAsync>d__14.MoveNext() in D:\\a\\1\\s\\src\\Umbraco.Web\\Install\\Controllers\\InstallApiController.cs:line 236\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)\r\n at Umbraco.Web.Install.Controllers.InstallApiController.<PostPerformInstall>d__11.MoveNext() in D:\\a\\1\\s\\src\\Umbraco.Web\\Install\\Controllers\\InstallApiController.cs:line 104","Step":"DatabaseUpgrade","SourceContext":"Umbraco.Web.Install.Controllers.InstallApiController","ProcessId":10644,"ProcessName":"iisexpress","ThreadId":16,"AppDomainId":3,"AppDomainAppId":"LMW3SVC5ROOT","MachineName":"PC34-T15P","Log4NetLevel":"ERROR","HttpRequestNumber":7,"HttpRequestId":"8d51a625-2f05-45dd-b7b1-31039c59f820"}
{"@t":"2022-06-29T11:53:09.4809691Z","@mt":"{EndMessage} ({Duration}ms) [Timing {TimingId}]","EndMessage":"Step completed","Duration":61577149,"TimingId":"4711588","SourceContext":"Umbraco.Web.Install.Controllers.InstallApiController","ProcessId":10644,"ProcessName":"iisexpress","ThreadId":16,"AppDomainId":3,"AppDomainAppId":"LMW3SVC5ROOT","MachineName":"PC34-T15P","Log4NetLevel":"INFO ","HttpRequestNumber":7,"HttpRequestId":"8d51a625-2f05-45dd-b7b1-31039c59f820"}
{"@t":"2022-06-29T11:53:09.4819691Z","@mt":"An error occurred during installation step {Step}","@l":"Error","@x":"System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Umbraco.Web.Install.InstallException: The database failed to upgrade. ERROR: The database configuration failed with the following message: Invalid column name 'versionId'.\n Please check log file for additional information (can be found in '/App_Data/Logs/')\r\n at Umbraco.Web.Install.InstallSteps.DatabaseUpgradeStep.ExecuteAsync(Object model) in D:\\a\\1\\s\\src\\Umbraco.Web\\Install\\InstallSteps\\DatabaseUpgradeStep.cs:line 47\r\n --- End of inner exception stack trace ---\r\n at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)\r\n at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)\r\n at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)\r\n at Umbraco.Web.Install.Controllers.InstallApiController.<ExecuteStepAsync>d__14.MoveNext() in D:\\a\\1\\s\\src\\Umbraco.Web\\Install\\Controllers\\InstallApiController.cs:line 236\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)\r\n at Umbraco.Web.Install.Controllers.InstallApiController.<PostPerformInstall>d__11.MoveNext() in D:\\a\\1\\s\\src\\Umbraco.Web\\Install\\Controllers\\InstallApiController.cs:line 104","Step":"DatabaseUpgrade","SourceContext":"Umbraco.Web.Install.Controllers.InstallApiController","ProcessId":10644,"ProcessName":"iisexpress","ThreadId":16,"AppDomainId":3,"AppDomainAppId":"LMW3SVC5ROOT","MachineName":"PC34-T15P","Log4NetLevel":"ERROR","HttpRequestNumber":7,"HttpRequestId":"8d51a625-2f05-45dd-b7b1-31039c59f820"}
Upgrade 7.17.7 -> 8.2.3: Invalid column name 'versionId'
Hi,
We're having quite a frustrating time trying to upgrade Umbraco 7 to a later version, and I'm hoping someone can provide a bit of insight.
We are following the directions to migrate from v. 7.17.7 to 8.2.3 (we're on our way to 9+, but I gathered from much documentation that taking it in smaller steps is preferable).
Data conversion starts as expected, and things look good i the log. After a long time (20+ hours), we get a failure "Invalid column name 'versionId'" in the logs. The log file doesn't state on which table, but comparing the logs with the source code, I suspect that the error occurs on line 250 of VariantsMigration.cs:
cmsContentVersion
does contain theversionId
column before initiating the upgrade, and I see nothing in the logs to indicate that the column has been changed before this failure.This is not due to database timeout. We have had a go at this using several different set-ups, and while the upgrade time can vary, the point at which it fails is consistent.
The last lines of the log file are below (...following tables were found in the database, but are not in the current schema... message truncated):
Hi Carsten, Did you overcome this issue? I'm having the same error in my logs as well.
is working on a reply...