Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Steve Brereton 32 posts 173 karma points
    Aug 06, 2024 @ 13:43
    Steve Brereton
    0

    Migration to 8.1 from 7.15 throwing SQL error

    I initially thought this might be connected to the obselete data types and Umbraco trying to convert something the wrong way.

    I've fixed that since and have run SQL profiler alongside the upgrade window and the log to try and spot anything.

        {"@t":"2024-08-06T09:14:46.1114024Z","@mt":"SQL [{ContextIndex}]: {Sql}","ContextIndex":9167,"Sql":"ALTER TABLE [cmsTemplate] DROP COLUMN [design];","SourceContext":"Umbraco.Core.Migrations.Expressions.Delete.Expressions.DeleteColumnExpression","ProcessId":16648,"ProcessName":"w3wp","ThreadId":10,"AppDomainId":3,"AppDomainAppId":"LMW3SVC7ROOT","MachineName":"INTRAWEBTEST","Log4NetLevel":"INFO ","HttpRequestNumber":8,"HttpRequestId":"34e87962-4f6b-4242-a108-58cd04c4fa78"}
    {"@t":"2024-08-06T09:14:46.1134070Z","@mt":"At {OrigState}","OrigState":"{08919C4B-B431-449C-90EC-2B8445B5C6B1}","SourceContext":"Umbraco.Core.Migrations.MigrationPlan","ProcessId":16648,"ProcessName":"w3wp","ThreadId":10,"AppDomainId":3,"AppDomainAppId":"LMW3SVC7ROOT","MachineName":"INTRAWEBTEST","Log4NetLevel":"INFO ","HttpRequestNumber":8,"HttpRequestId":"34e87962-4f6b-4242-a108-58cd04c4fa78"}
    {"@t":"2024-08-06T09:14:46.1134070Z","@mt":"Execute {MigrationType}","MigrationType":"TablesForScheduledPublishing","SourceContext":"Umbraco.Core.Migrations.MigrationPlan","ProcessId":16648,"ProcessName":"w3wp","ThreadId":10,"AppDomainId":3,"AppDomainAppId":"LMW3SVC7ROOT","MachineName":"INTRAWEBTEST","Log4NetLevel":"INFO ","HttpRequestNumber":8,"HttpRequestId":"34e87962-4f6b-4242-a108-58cd04c4fa78"}
    {"@t":"2024-08-06T09:15:00.6864523Z","@mt":"Database configuration failed","@l":"Error","@x":"System.InvalidCastException: Invalid cast from 'System.DateTime' to 'System.ValueTuple`2[[System.Nullable`1[[System.DateTime, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Nullable`1[[System.DateTime, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'.\r\n   at System.Convert.DefaultToType(IConvertible value, Type targetType, IFormatProvider provider)\r\n   at NPoco.Database.Dictionary[TKey,TValue](String sql, Object[] args)\r\n   at Umbraco.Core.Migrations.Upgrade.V_8_0_0.TablesForScheduledPublishing.Migrate()\r\n   at Umbraco.Core.Migrations.MigrationBase.Umbraco.Core.Migrations.IMigration.Migrate()\r\n   at Umbraco.Core.Migrations.MigrationPlan.Execute(IScope scope, String fromState, IMigrationBuilder migrationBuilder, ILogger logger)\r\n   at Umbraco.Core.Migrations.Upgrade.Upgrader.Execute(IScopeProvider scopeProvider, IMigrationBuilder migrationBuilder, IKeyValueService keyValueService, ILogger logger)\r\n   at Umbraco.Core.Migrations.Install.DatabaseBuilder.UpgradeSchemaAndData(MigrationPlan plan)","SourceContext":"Umbraco.Core.Migrations.Install.DatabaseBuilder","ProcessId":16648,"ProcessName":"w3wp","ThreadId":10,"AppDomainId":3,"AppDomainAppId":"LMW3SVC7ROOT","MachineName":"INTRAWEBTEST","Log4NetLevel":"ERROR","HttpRequestNumber":8,"HttpRequestId":"34e87962-4f6b-4242-a108-58cd04c4fa78"}
    {"@t":"2024-08-06T09:15:00.6924578Z","@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\numbracoDeployChecksum,umbracoDeployDependency,cmsMedia,cmsContent,cmsContentVersion,cmsContentXml,cmsDataType,cmsDataTypePreValues,cmsDocument,cmsPreviewXml,cmsPropertyData,cmsTask,cmsTaskType,umbracoDomains,umbracoMigration,umbracoContent,umbracoContentVersion,umbracoMediaVersion,umbracoDocument,umbracoDataType,umbracoDomain,umbracoPropertyData,cmsContentNu,umbracoDocumentVersion,umbracoKeyValue,umbracoContentVersionCultureVariation,umbracoDocumentCultureVariation,umbracoContentSchedule\r\n \r\nThe following columns were found in the database, but are not in the current schema:\r\numbracoDeployChecksum,id,umbracoDeployChecksum,entityType,umbracoDeployChecksum,entityGuid,umbracoDeployChecksum,entityPath,umbracoDeployChecksum,localChecksum,umbracoDeployChecksum,compositeChecksum,umbracoDeployDependency,sourceId,umbracoDeployDependency,targetId,umbracoDeployDependency,mode,cmsMedia,nodeId,cmsMedia,versionId,cmsMedia,mediaPath,cmsContent,pk,cmsContent,nodeId,cmsContent,contentType,cmsContentVersion,id,cmsContentVersion,ContentId,cmsContentVersion,VersionId,cmsContentVersion,VersionDate,cmsContentXml,nodeId,cmsContentXml,xml,cmsDataType,pk,cmsDataType,nodeId,cmsDataType,propertyEditorAlias,cmsDataType,dbType,cmsDataTypePreValues,id,cmsDataTypePreValues,datatypeNodeId,cmsDataTypePreValues,value,cmsDataTypePreValues,sortorder,cmsDataTypePreValues,alias,cmsDocument,nodeId,cmsDocument,published,cmsDocument,documentUser,cmsDocument,versionId,cmsDocument,text,cmsDocument,releaseDate,cmsDocument,expireDate,cmsDocument,updateDate,cmsDocument,templateId,cmsDocument,alias,cmsDocument,newest,cmsMacro,macroScriptType,cmsMacro,macroScriptAssembly,cmsMacro,macroXSLT,cmsMacro,macroPython,cmsPreviewXml,nodeId,cmsPreviewXml,versionId,cmsPreviewXml,timestamp,cmsPreviewXml,xml,cmsPropertyData,id,cmsPropertyData,contentNodeId,cmsPropertyData,versionId,cmsPropertyData,propertytypeid,cmsPropertyData,dataInt,cmsPropertyData,dataDate,cmsPropertyData,dataNvarchar,cmsPropertyData,dataNtext,cmsPropertyData,dataDecimal,cmsTags,ParentId,cmsTask,closed,cmsTask,id,cmsTask,taskTypeId,cmsTask,nodeId,cmsTask,parentUserId,cmsTask,userId,cmsTask,DateTime,cmsTask,Comment,cmsTaskType,id,cmsTaskType,alias,cmsTemplate,design,umbracoDomains,id,umbracoDomains,domainDefaultLanguage,umbracoDomains,domainRootStructureID,umbracoDomains,domainName,umbracoMigration,id,umbracoMigration,name,umbracoMigration,version,umbracoMigration,createDate,cmsContentType,isElement,cmsContentType,variations,umbracoContent,nodeId,umbracoContent,contentTypeId,umbracoContentVersion,id,umbracoContentVersion,nodeId,umbracoContentVersion,versionDate,umbracoContentVersion,userId,umbracoContentVersion,current,umbracoContentVersion,text,umbracoMediaVersion,id,umbracoMediaVersion,path,umbracoDocument,nodeId,umbracoDocument,published,umbracoDocument,edited,umbracoDataType,nodeId,umbracoDataType,propertyEditorAlias,umbracoDataType,dbType,umbracoDataType,config,umbracoLanguage,isDefaultVariantLang,umbracoLanguage,mandatory,umbracoLanguage,fallbackLanguageId,umbracoDomain,id,umbracoDomain,domainDefaultLanguage,umbracoDomain,domainRootStructureID,umbracoDomain,domainName,umbracoLog,entityType,umbracoLog,parameters,cmsMacro,macroSource,cmsMacro,macroType,cmsPropertyType,variations,umbracoPropertyData,id,umbracoPropertyData,versionId,umbracoPropertyData,propertyTypeId,umbracoPropertyData,languageId,umbracoPropertyData,segment,umbracoPropertyData,intValue,umbracoPropertyData,decimalValue,umbracoPropertyData,dateValue,umbracoPropertyData,varcharValue,umbracoPropertyData,textValue,cmsTags,languageId,umbracoRedirectUrl,culture,cmsContentNu,nodeId,cmsContentNu,published,cmsContentNu,data,cmsContentNu,rv,umbracoDocumentVersion,id,umbracoDocumentVersion,templateId,umbracoDocumentVersion,published,umbracoKeyValue,key,umbracoKeyValue,value,umbracoKeyValue,updated,umbracoContentVersionCultureVariation,id,umbracoContentVersionCultureVariation,versionId,umbracoContentVersionCultureVariation,languageId,umbracoContentVersionCultureVariation,name,umbracoContentVersionCultureVariation,date,umbracoContentVersionCultureVariation,availableUserId,umbracoDocumentCultureVariation,id,umbracoDocumentCultureVariation,nodeId,umbracoDocumentCultureVariation,languageId,umbracoDocumentCultureVariation,edited,umbracoDocumentCultureVariation,available,umbracoDocumentCultureVariation,published,umbracoDocumentCultureVariation,name,umbracoContentSchedule,id,umbracoContentSchedule,nodeId,umbracoContentSchedule,languageId,umbracoContentSchedule,date,umbracoContentSchedule,action\r\n \r\nThe following constraints (Primary Keys, Foreign Keys and Indexes) were found in the database, but are not in the current schema:\r\nFK_cmsContent_umbracoNode_id,FK_cmsContentVersion_cmsContent_nodeId,FK_cmsContentXml_cmsContent_nodeId,FK_cmsDataType_umbracoNode_id,FK_cmsDataTypePreValues_cmsDataType_nodeId,FK_cmsDocument_cmsContent_nodeId,FK_cmsDocument_cmsTemplate_nodeId,FK_cmsDocument_umbracoNode_id,FK_cmsMedia_cmsContent_nodeId,FK_cmsMedia_umbracoNode_id,FK_cmsMember_cmsContent_nodeId,FK_cmsMember_umbracoNode_id,FK_cmsPreviewXml_cmsContent_nodeId,FK_cmsPreviewXml_cmsContentVersion_VersionId,FK_cmsPropertyData_cmsPropertyType_id,FK_cmsPropertyData_umbracoNode_id,FK_cmsPropertyType_cmsDataType_nodeId,FK_cmsTags_cmsTags,FK_cmsTask_cmsTaskType_id,FK_cmsTask_umbracoNode_id,FK_cmsTask_umbracoUser,FK_cmsTask_umbracoUser1,FK_umbracoDeployDependency_umbracoDeployChecksum_id1,FK_umbracoDeployDependency_umbracoDeployChecksum_id2,FK_umbracoDomains_umbracoNode_id,FK_umbracoExternalLogin_umbracoUser_id,FK_umbracoRedirectUrl,FK_umbracoNode_umbracoUser_id,FK_umbracoContent_umbracoNode_id,FK_umbracoContent_cmsContentType_NodeId,FK_umbracoContentVersion_umbracoContent_nodeId,FK_umbracoContentVersion_umbracoUser_id,FK_umbracoMediaVersion_umbracoContentVersion_id,FK_umbracoDocument_umbracoContent_nodeId,FK_umbracoDataType_umbracoNode_id,FK_umbracoLanguage_umbracoLanguage_id,FK_umbracoDomain_umbracoNode_id,FK_umbracoLog_umbracoUser_id,FK_cmsMember_umbracoContent_nodeId,FK_cmsPropertyType_umbracoDataType_nodeId,FK_umbracoPropertyData_umbracoContentVersion_id,FK_umbracoPropertyData_cmsPropertyType_id,FK_umbracoPropertyData_umbracoLanguage_id,FK_cmsTags_umbracoLanguage_id,FK_umbracoRedirectUrl_umbracoNode_uniqueID,FK_cmsContentNu_umbracoContent_nodeId,FK_umbracoDocumentVersion_umbracoContentVersion_id,FK_umbracoDocumentVersion_cmsTemplate_nodeId,FK_umbracoContentVersionCultureVariation_umbracoContentVersion_id,FK_umbracoContentVersionCultureVariation_umbracoLanguage_id,FK_umbracoContentVersionCultureVariation_umbracoUser_id,FK_umbracoDocumentCultureVariation_umbracoNode_id,FK_umbracoDocumentCultureVariation_umbracoLanguage_id,FK_umbracoContentSchedule_umbracoContent_nodeId,FK_umbracoContentSchedule_umbracoLanguage_id,PK_cmsContent,PK_cmsContentPreviewXml,PK_cmsContentVersion,PK_cmsContentXml,PK_cmsDataType,PK_cmsDataTypePreValues,PK_cmsDocument,PK_cmsMedia,PK_cmsPropertyData,PK_cmsTask,PK_cmsTaskType,PK_structure,PK_umbracoDeployChecksum,PK_umbracoDeployDependency,PK_umbracoDomains,PK_umbracoMigrations,PK_umbracoNode,PK_umbracoContent,PK_umbracoContentVersion,PK_umbracoMediaVersion,PK_umbracoDocument,PK_umbracoDataType,PK_umbracoDomain,PK_umbracoPropertyData,PK_cmsContentNu,PK_umbracoDocumentVersion,PK_umbracoKeyValue,PK_umbracoContentVersionCultureVariation,PK_umbracoDocumentCultureVariation,PK_umbracoContentSchedule\r\n \r\nThe following indexes were found in the database, but are not in the current schema:\r\nIX_cmsContent,IX_cmsContentVersion_ContentId,IX_cmsContentVersion_VersionId,IX_cmsDataType_nodeId,IX_cmsDocument,IX_cmsDocument_newest,IX_cmsDocument_published,IX_cmsMedia,IX_cmsPropertyData_1,IX_cmsPropertyData_2,IX_cmsPropertyData_3,IX_cmsTaskType_alias,IX_umbracoDeployChecksum,IX_umbracoMigration,IX_umbracoNodeObjectType,IX_umbracoNodeParentId,IX_umbracoNodePath,IX_umbracoNodeTrashed,IX_umbracoNode_ParentId,IX_umbracoNode_Path,IX_umbracoNode_Trashed,IX_umbracoNode_ObjectType,IX_umbracoMediaVersion,IX_umbracoDocument_Published,IX_umbracoLanguage_fallbackLanguageId,IX_umbracoPropertyData_VersionId,IX_umbracoPropertyData_PropertyTypeId,IX_umbracoPropertyData_LanguageId,IX_umbracoPropertyData_Segment,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":16648,"ProcessName":"w3wp","ThreadId":10,"AppDomainId":3,"AppDomainAppId":"LMW3SVC7ROOT","MachineName":"INTRAWEBTEST","Log4NetLevel":"INFO ","HttpRequestNumber":8,"HttpRequestId":"34e87962-4f6b-4242-a108-58cd04c4fa78"}
    {"@t":"2024-08-06T09:15:00.7470807Z","@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 cast from 'System.DateTime' to 'System.ValueTuple`2[[System.Nullable`1[[System.DateTime, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Nullable`1[[System.DateTime, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'.\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)\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()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at Umbraco.Web.Install.Controllers.InstallApiController.<PostPerformInstall>d__11.MoveNext()","Step":"DatabaseUpgrade","SourceContext":"Umbraco.Web.Install.Controllers.InstallApiController","ProcessId":16648,"ProcessName":"w3wp","ThreadId":10,"AppDomainId":3,"AppDomainAppId":"LMW3SVC7ROOT","MachineName":"INTRAWEBTEST","Log4NetLevel":"ERROR","HttpRequestNumber":8,"HttpRequestId":"34e87962-4f6b-4242-a108-58cd04c4fa78"}
    {"@t":"2024-08-06T09:15:00.7470807Z","@mt":"{EndMessage} ({Duration}ms) [Timing {TimingId}]","EndMessage":"Step completed","Duration":2848886,"TimingId":"f0b25af","SourceContext":"Umbraco.Web.Install.Controllers.InstallApiController","ProcessId":16648,"ProcessName":"w3wp","ThreadId":10,"AppDomainId":3,"AppDomainAppId":"LMW3SVC7ROOT","MachineName":"INTRAWEBTEST","Log4NetLevel":"INFO ","HttpRequestNumber":8,"HttpRequestId":"34e87962-4f6b-4242-a108-58cd04c4fa78"}
    {"@t":"2024-08-06T09:15:00.7470807Z","@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 cast from 'System.DateTime' to 'System.ValueTuple`2[[System.Nullable`1[[System.DateTime, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Nullable`1[[System.DateTime, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'.\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)\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()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at Umbraco.Web.Install.Controllers.InstallApiController.<PostPerformInstall>d__11.MoveNext()","Step":"DatabaseUpgrade","SourceContext":"Umbraco.Web.Install.Controllers.InstallApiController","ProcessId":16648,"ProcessName":"w3wp","ThreadId":10,"AppDomainId":3,"AppDomainAppId":"LMW3SVC7ROOT","MachineName":"INTRAWEBTEST","Log4NetLevel":"ERROR","HttpRequestNumber":8,"HttpRequestId":"34e87962-4f6b-4242-a108-58cd04c4fa78"}
    

    So, the profiler shows the ALTER TABLE [cmsTemplate] DROP COLUMN [design]; command, followed by SELECT nodeId, releaseDate, expreDate from umbracoDocument WHERE (releaseDate Is NOT NULL or expireDate IS NOT NULL

    Thing is, I can't see a table or view that is called umbracoDocument. There is one called cmsDocument, and that returns some results.

    Line 6 of the log

    Invalid cast from 'System.DateTime' to 'System.ValueTuple`
    

    is where the upgrade seems to fail, and I suspect this is linked back to the previous SQL command, where the wrong table name is used.

    I'm upgrading to v8.1 based on the advice of the '7 to 8' upgrade page. I don't know how the upgrade is scripted , but is it possible the script is the wrong one?

Please Sign in or register to post replies

Write your reply to:

Draft