I'm trying to migrate a client's database from v7.15.1 to v8.2 it keeps failing on the same Foriegn Key constraint "FKumbracoPropertyDataumbracoContentVersion_id". I've tried migration to v8.0 through v8.2.1 with the same result. The Umbraco Database is on MS SQL Server 2012, I'm using a restore of a production database to test the migration before implementing it in production. I've noted I'm able to upgrade from a vanilla install of v7.15.1 to v8.2 so I think it is specific to our database. The problem database has previously been upgraded to my recollection from: v4.x.x=>v6.x.x=>7.3.0=>7.3.1=>7.4.3=>7.13.0=>7.13.1=>7.15.1
Note the migration has not been "smooth" at all as I've had make several minor correction using solutions found here and on Github to get to this point where it fails...
Below is screenshot of the error and the relevant log entries:
Log:
{"@t":"2019-10-30T14:11:36.4824092Z","@mt":"SQL [{ContextIndex}]: {Sql}","ContextIndex":695,"Sql":"CREATE UNIQUE NONCLUSTERED INDEX [IXumbracoPropertyDataVersionId] ON [umbracoPropertyData] ([versionId],[propertyTypeId],[languageId],[segment])","SourceContext":"Umbraco.Core.Migrations.Expressions.Execute.Expressions.ExecuteSqlStatementExpression","ProcessId":14144,"ProcessName":"w3wp","ThreadId":8,"AppDomainId":3,"AppDomainAppId":"LMW3SVC3ROOT","MachineName":"Umbraco","Log4NetLevel":"INFO ","HttpRequestNumber":7,"HttpRequestId":"1d4fbb3a-e2df-42e1-b32d-99edb8239fc2"}
{"@t":"2019-10-30T14:11:36.7157274Z","@mt":"SQL [{ContextIndex}]: {Sql}","ContextIndex":696,"Sql":"CREATE NONCLUSTERED INDEX [IXumbracoPropertyDataPropertyTypeId] ON [umbracoPropertyData] ([propertyTypeId])","SourceContext":"Umbraco.Core.Migrations.Expressions.Execute.Expressions.ExecuteSqlStatementExpression","ProcessId":14144,"ProcessName":"w3wp","ThreadId":8,"AppDomainId":3,"AppDomainAppId":"LMW3SVC3ROOT","MachineName":"Umbraco","Log4NetLevel":"INFO ","HttpRequestNumber":7,"HttpRequestId":"1d4fbb3a-e2df-42e1-b32d-99edb8239fc2"}
{"@t":"2019-10-30T14:11:37.4919063Z","@mt":"SQL [{ContextIndex}]: {Sql}","ContextIndex":697,"Sql":"CREATE NONCLUSTERED INDEX [IXumbracoPropertyDataLanguageId] ON [umbracoPropertyData] ([languageId])","SourceContext":"Umbraco.Core.Migrations.Expressions.Execute.Expressions.ExecuteSqlStatementExpression","ProcessId":14144,"ProcessName":"w3wp","ThreadId":8,"AppDomainId":3,"AppDomainAppId":"LMW3SVC3ROOT","MachineName":"Umbraco","Log4NetLevel":"INFO ","HttpRequestNumber":7,"HttpRequestId":"1d4fbb3a-e2df-42e1-b32d-99edb8239fc2"}
{"@t":"2019-10-30T14:11:38.2903093Z","@mt":"SQL [{ContextIndex}]: {Sql}","ContextIndex":698,"Sql":"CREATE NONCLUSTERED INDEX [IXumbracoPropertyDataSegment] ON [umbracoPropertyData] ([segment])","SourceContext":"Umbraco.Core.Migrations.Expressions.Execute.Expressions.ExecuteSqlStatementExpression","ProcessId":14144,"ProcessName":"w3wp","ThreadId":8,"AppDomainId":3,"AppDomainAppId":"LMW3SVC3ROOT","MachineName":"Umbraco","Log4NetLevel":"INFO ","HttpRequestNumber":7,"HttpRequestId":"1d4fbb3a-e2df-42e1-b32d-99edb8239fc2"}
{"@t":"2019-10-30T14:11:39.0459944Z","@mt":"SQL [{ContextIndex}]: {Sql}","ContextIndex":699,"Sql":"ALTER TABLE [umbracoPropertyData] ADD CONSTRAINT [FKumbracoPropertyDataumbracoContentVersionid] FOREIGN KEY ([versionId]) REFERENCES [umbracoContentVersion] ([id])","SourceContext":"Umbraco.Core.Migrations.Expressions.Execute.Expressions.ExecuteSqlStatementExpression","ProcessId":14144,"ProcessName":"w3wp","ThreadId":8,"AppDomainId":3,"AppDomainAppId":"LMW3SVC3ROOT","MachineName":"Umbraco","Log4NetLevel":"INFO ","HttpRequestNumber":7,"HttpRequestId":"1d4fbb3a-e2df-42e1-b32d-99edb8239fc2"}
{"@t":"2019-10-30T14:14:28.3423177Z","@mt":"Exception ({InstanceId}).","@l":"Error","@x":"System.Data.SqlClient.SqlException (0x80131904): The ALTER TABLE statement conflicted with the FOREIGN KEY constraint \"FKumbracoPropertyDataumbracoContentVersionid\". The conflict occurred in database \"Sandbox\", table \"dbo.umbracoContentVersion\", column 'id'.\r\n at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 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(TaskCompletionSource1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)\r\n at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()\r\n at Umbraco.Core.Persistence.FaultHandling.RetryPolicy.ExecuteAction[TResult](Func1 func)\r\n at NPoco.Database.ExecuteNonQueryHelper(DbCommand cmd)\r\n at NPoco.Database.Execute(String sql, CommandType commandType, Object[] args)\r\nClientConnectionId:383e2442-0e50-4a10-a8d9-42a396b50ab3\r\nError Number:547,State:0,Class:16","InstanceId":"f0e8cfda","SourceContext":"Umbraco.Core.Persistence.UmbracoDatabase","ProcessId":14144,"ProcessName":"w3wp","ThreadId":8,"AppDomainId":3,"AppDomainAppId":"LMW3SVC3ROOT","MachineName":"Umbraco","Log4NetLevel":"ERROR","HttpRequestNumber":7,"HttpRequestId":"1d4fbb3a-e2df-42e1-b32d-99edb8239fc2"}
{"@t":"2019-10-30T14:14:28.3763240Z","@mt":"Database configuration failed","@l":"Error","@x":"System.Data.SqlClient.SqlException (0x80131904): The ALTER TABLE statement conflicted with the FOREIGN KEY constraint \"FK_umbracoPropertyData_umbracoContentVersion_id\". The conflict occurred in database \"Sandbox\", table \"dbo.umbracoContentVersion\", column 'id'.\r\n at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 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(TaskCompletionSource1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)\r\n at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()\r\n at Umbraco.Core.Persistence.FaultHandling.RetryPolicy.ExecuteAction[TResult](Func1 func)\r\n at NPoco.Database.ExecuteNonQueryHelper(DbCommand cmd)\r\n at NPoco.Database.Execute(String sql, CommandType commandType, Object[] args)\r\n at Umbraco.Core.Migrations.MigrationExpressionBase.ExecuteStatement(StringBuilder stmtBuilder)\r\n at Umbraco.Core.Migrations.MigrationExpressionBase.Execute()\r\n at Umbraco.Core.Migrations.Expressions.Create.KeysAndIndexes.CreateKeysAndIndexesBuilder.Do()\r\n at Umbraco.Core.Migrations.Upgrade.Common.CreateKeysAndIndexes.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)\r\nClientConnectionId:383e2442-0e50-4a10-a8d9-42a396b50ab3\r\nError Number:547,State:0,Class:16","SourceContext":"Umbraco.Core.Migrations.Install.DatabaseBuilder","ProcessId":14144,"ProcessName":"w3wp","ThreadId":8,"AppDomainId":3,"AppDomainAppId":"LMW3SVC3ROOT","MachineName":"Umbraco","Log4NetLevel":"ERROR","HttpRequestNumber":7,"HttpRequestId":"1d4fbb3a-e2df-42e1-b32d-99edb8239fc2"}
{"@t":"2019-10-30T14:14:28.3894914Z","@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\ncmsPropertyData,cmsContent,cmsContentVersion,cmsContentXml,cmsDataType,cmsDataTypePreValues,umbracoDomains,cmsMedia,cmsTask,cmsTaskType,umbracoMigration,cmsPreviewXml,cmsDocument,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\ncmsPropertyData,id,cmsPropertyData,contentNodeId,cmsPropertyData,propertytypeid,cmsPropertyData,dataInt,cmsPropertyData,dataDate,cmsPropertyData,dataNvarchar,cmsPropertyData,dataNtext,cmsPropertyData,dataDecimal,cmsPropertyData,versionId,cmsContent,pk,cmsContent,nodeId,cmsContent,contentType,cmsTemplate,design,cmsMacro,macroScriptType,cmsMacro,macroScriptAssembly,cmsMacro,macroXSLT,cmsMacro,macroPython,cmsContentVersion,id,cmsContentVersion,ContentId,cmsContentVersion,VersionId,cmsContentVersion,VersionDate,cmsContentXml,nodeId,cmsContentXml,xml,cmsDataType,pk,cmsDataType,nodeId,cmsDataType,dbType,cmsDataType,propertyEditorAlias,cmsDataTypePreValues,id,cmsDataTypePreValues,datatypeNodeId,cmsDataTypePreValues,value,cmsDataTypePreValues,sortorder,cmsDataTypePreValues,alias,umbracoDomains,id,umbracoDomains,domainDefaultLanguage,umbracoDomains,domainRootStructureID,umbracoDomains,domainName,cmsMedia,nodeId,cmsMedia,versionId,cmsMedia,mediaPath,cmsTask,closed,cmsTask,id,cmsTask,taskTypeId,cmsTask,nodeId,cmsTask,parentUserId,cmsTask,userId,cmsTask,DateTime,cmsTask,Comment,cmsTaskType,id,cmsTaskType,alias,cmsTags,parentId,umbracoMigration,id,umbracoMigration,name,umbracoMigration,version,umbracoMigration,createDate,cmsPreviewXml,nodeId,cmsPreviewXml,versionId,cmsPreviewXml,timestamp,cmsPreviewXml,xml,cmsDocument,nodeId,cmsDocument,published,cmsDocument,documentUser,cmsDocument,versionId,cmsDocument,text,cmsDocument,releaseDate,cmsDocument,expireDate,cmsDocument,updateDate,cmsDocument,templateId,cmsDocument,newest,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\nFKcmsContentcmsContentTypenodeId,FKcmsContentumbracoNode,FKcmsContentTypeumbracoNode,FKcmsDataTypeumbracoNode,FKcmsDataTypePreValuescmsDataType,FKcmsDocumentcmsTemplate,FKcmsDocumentumbracoNode,FKcmsDocumentTypecmsContentType,FKcmsDocumentTypecmsTemplate,FKcmsDocumentTypeumbracoNode,FKcmsLanguageTextcmsDictionary,FKcmsMacroPropertycmsMacro,FKcmsMediacmsContentnodeId,FKcmsMediaumbracoNodeid,FKcmsMemberumbracoNode,FKcmsMember2MemberGroupcmsMember,FKcmsMember2MemberGroupumbracoNode,FKcmsMemberTypecmsContentType,FKcmsMemberTypeumbracoNode,FKcmsPropertyDatacmsPropertyType,FKcmsPropertyDataumbracoNode,FKcmsPropertyTypecmsContentType,FKcmsPropertyTypecmsDataType,FKcmsPropertyTypecmsTab,FKcmsTabcmsContentType,FKcmsTagscmsTags,FKcmsTaskcmsTaskType,FKcmsTaskumbracoNode,FKcmsTaskumbracoUser,FKcmsTaskumbracoUser1,FKumbracoDomainsumbracoNode,FKumbracoExternalLoginumbracoUserid,FKumbracoNodeumbracoNode,FKumbracoRedirectUrl,FKumbracoRelationumbracoRelationType,FKumbracoUser2NodeNotifyumbracoNode,FKumbracoUser2NodeNotifyumbracoUser,FKumbracoNodeumbracoNodeid,FKumbracoNodeumbracoUserid,FKcmsContentTypeumbracoNodeid,FKumbracoContentumbracoNodeid,FKumbracoContentcmsContentTypeNodeId,FKumbracoContentVersionumbracoContentnodeId,FKumbracoContentVersionumbracoUserid,FKumbracoMediaVersionumbracoContentVersionid,FKumbracoDocumentumbracoContentnodeId,FKcmsDocumentTypecmsContentTypenodeId,FKcmsDocumentTypeumbracoNodeid,FKcmsDocumentTypecmsTemplatenodeId,FKumbracoDataTypeumbracoNodeid,FKumbracoLanguageumbracoLanguageid,FKcmsLanguageTextcmsDictionaryid,FKumbracoDomainumbracoNodeid,FKumbracoLogumbracoUserid,FKcmsMacroPropertycmsMacroid,FKcmsMemberTypeumbracoNodeid,FKcmsMemberTypecmsContentTypenodeId,FKcmsMemberumbracoContentnodeId,FKcmsMember2MemberGroupcmsMembernodeId,FKcmsMember2MemberGroupumbracoNodeid,FKcmsPropertyTypeGroupcmsContentTypenodeId,FKcmsPropertyTypeumbracoDataTypenodeId,FKcmsPropertyTypecmsContentTypenodeId,FKcmsPropertyTypecmsPropertyTypeGroupid,FKumbracoPropertyDataumbracoContentVersionid,FKumbracoPropertyDatacmsPropertyTypeid,FKumbracoPropertyDataumbracoLanguageid,FKumbracoRelationumbracoRelationTypeid,FKcmsTagsumbracoLanguageid,FKcmsTagRelationshipcmsContent,FKcmsTagRelationshipcmsTagsid,FKcmsContentType2ContentTypeumbracoNodeparent,FKcmsContentType2ContentTypeumbracoNodechild,FKumbracoUser2NodeNotifyumbracoUserid,FKumbracoUser2NodeNotifyumbracoNodeid,FKumbracoRedirectUrlumbracoNodeuniqueID,FKcmsContentNuumbracoContentnodeId,FKumbracoDocumentVersionumbracoContentVersionid,FKumbracoDocumentVersioncmsTemplatenodeId,FKumbracoContentVersionCultureVariationumbracoContentVersionid,FKumbracoContentVersionCultureVariationumbracoLanguageid,FKumbracoContentVersionCultureVariationumbracoUserid,FKumbracoDocumentCultureVariationumbracoNodeid,FKumbracoDocumentCultureVariationumbracoLanguageid,FKumbracoContentScheduleumbracoContentnodeId,FKumbracoContentScheduleumbracoLanguageid,PKcmsContentVersio38996AB5,PKcmsContent,PKcmsContentPreviewXml,PKcmsContentXml,PKcmsDataType,PKcmsDataTypePreValues,PKcmsDocument,PKcmsMedia,PKcmsPropertyData,PKcmsTab,PKcmsTask,PKcmsTaskType,PKdomains,PKlanguage,PKmacro,PKmacroProperty,PKstructure,PKtemplates,PKumbracoMigrations,PKumbracoNode,PKcmsTemplate,PKumbracoContent,PKumbracoContentVersion,PKumbracoMediaVersion,PKumbracoDocument,PKumbracoDataType,PKumbracoLanguage,PKumbracoDomain,PKcmsMacro,PKcmsMacroProperty,PKcmsPropertyTypeGroup,PKumbracoPropertyData,PKcmsContentNu,PKumbracoDocumentVersion,PKumbracoKeyValue,PKumbracoContentVersionCultureVariation,PKumbracoDocumentCultureVariation,PKumbracoContentSchedule\r\n \r\nThe following indexes were found in the database, but are not in the current schema:\r\nIXcmsContent,IXIcon,IXcmsContentVersion,IXcmsContentVersionContentId,IXcmsDataType,IXcmsDictionary,IXcmsDocument,IXcmsDocumentnewest,IXcmsDocumentpublished,IXcmsMacroAlias,IXcmsMedia,IXcmsPropertyData3,IXcmsTaskType,IXcmsTemplate,IXumbracoMigration,IXumbracoNodeObjectType,IXumbracoNodeParentId,IXumbracoNodePath,IXumbracoNodeTrashed,IXumbracoNodeUniqueID,IXumbracoUser,IXumbracoUseruserLogin,IXumbracoNodeParentId,IXumbracoNodePath,IXumbracoNodeTrashed,IXumbracoNodeObjectType,IXcmsContentTypeicon,IXcmsTemplatenodeId,IXumbracoMediaVersion,IXumbracoDocumentPublished,IXumbracoLanguagefallbackLanguageId,IXcmsMacroPropertyAlias,IXumbracoPropertyDataVersionId,IXumbracoPropertyDataPropertyTypeId,IXumbracoPropertyDataLanguageId,IXumbracoPropertyDataSegment,IXcmsTagsLanguageId,IXumbracoUserLoginlastValidatedUtc,IXumbracoContentVersionCultureVariationVersionId,IXumbracoContentVersionCultureVariationLanguageId,IXumbracoDocumentCultureVariationNodeId,IXumbracoDocumentCultureVariationLanguageId\r\n \r\nThe following unknown constraints (Primary Keys, Foreign Keys and Indexes) were found in the database, but are not in the current schema:\r\ncmsTagscmsTagRelationship\r\n \r\n","SourceContext":"Umbraco.Core.Migrations.Install.DatabaseBuilder","ProcessId":14144,"ProcessName":"w3wp","ThreadId":8,"AppDomainId":3,"AppDomainAppId":"LMW3SVC3ROOT","MachineName":"Umbraco","Log4NetLevel":"INFO ","HttpRequestNumber":7,"HttpRequestId":"1d4fbb3a-e2df-42e1-b32d-99edb8239fc2"}
{"@t":"2019-10-30T14:14:28.3923227Z","@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: The ALTER TABLE statement conflicted with the FOREIGN KEY constraint \"FKumbracoPropertyDataumbracoContentVersionid\". The conflict occurred in database \"Sandbox\", table \"dbo.umbracoContentVersion\", column 'id'.\n Please check log file for additional information (can be found in '/AppData/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.
Thanks in advance for any help given to get past the above error...
Your database probably has rows in cmsPropertyData for version IDs which no longer exist. In v7 these won't do much harm other than taking up space, but v8 adds this constraint so you'll need to delete them.
This should do the job:
delete from cmsPropertyData where versionid not in (select versionid from cmsContentVersion)
Running the sql did affect 2 rows in the cmsPropertyData table. Thank you Steve!! I had actually run that particular SQL statements before during the failed migration but it did not work because I had to for instance run the following SQL or the migration would be stuck for hours running the fix was to run the stated SQL before the other "fixes" i.e before:
DROP INDEX [IX_cmsPropertyData_1] ON [dbo].[cmsPropertyData] -- Drop Problem index 1
DROP INDEX [IX_cmsPropertyData_2] ON [dbo].[cmsPropertyData] -- Drop Problem index 2
ALTER TABLE cmsPropertyData ADD [versionId2] [int] NULL
UPDATE cmsPropertyData SET versionId2=cmsContentVersion.id FROM cmsContentVersion INNER JOIN cmsPropertyData ON cmsContentVersion.versionId = cmsPropertyData.versionId
ALTER TABLE cmsPropertyData DROP COLUMN [versionId]
EXEC sp_rename 'cmsPropertyData.versionId2', 'versionId', 'COLUMN'
-- Re-created droped indexes:
CREATE UNIQUE NONCLUSTERED INDEX [IX_cmsPropertyData_1] ON [dbo].[cmsPropertyData]
(
[contentNodeId] ASC,
[versionId] ASC,
[propertytypeid] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
CREATE NONCLUSTERED INDEX [IX_cmsPropertyData_2] ON [dbo].[cmsPropertyData]
(
[versionId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
-- Check cmsContentVersion containing document versions with no matching row in cmsDocument
SELECT *
FROM cmsContentVersion
WHERE VersionId NOT IN (SELECT versionId FROM cmsDocument)
AND ContentId IN (SELECT nodeId FROM cmsDocument)
Umbraco 7.15.1 Migration to 8.2 fails
I'm trying to migrate a client's database from v7.15.1 to v8.2 it keeps failing on the same Foriegn Key constraint "FKumbracoPropertyDataumbracoContentVersion_id". I've tried migration to v8.0 through v8.2.1 with the same result. The Umbraco Database is on MS SQL Server 2012, I'm using a restore of a production database to test the migration before implementing it in production. I've noted I'm able to upgrade from a vanilla install of v7.15.1 to v8.2 so I think it is specific to our database. The problem database has previously been upgraded to my recollection from: v4.x.x=>v6.x.x=>7.3.0=>7.3.1=>7.4.3=>7.13.0=>7.13.1=>7.15.1
Note the migration has not been "smooth" at all as I've had make several minor correction using solutions found here and on Github to get to this point where it fails...
Below is screenshot of the error and the relevant log entries:
Log:
{"@t":"2019-10-30T14:11:36.4824092Z","@mt":"SQL [{ContextIndex}]: {Sql}","ContextIndex":695,"Sql":"CREATE UNIQUE NONCLUSTERED INDEX [IXumbracoPropertyDataVersionId] ON [umbracoPropertyData] ([versionId],[propertyTypeId],[languageId],[segment])","SourceContext":"Umbraco.Core.Migrations.Expressions.Execute.Expressions.ExecuteSqlStatementExpression","ProcessId":14144,"ProcessName":"w3wp","ThreadId":8,"AppDomainId":3,"AppDomainAppId":"LMW3SVC3ROOT","MachineName":"Umbraco","Log4NetLevel":"INFO ","HttpRequestNumber":7,"HttpRequestId":"1d4fbb3a-e2df-42e1-b32d-99edb8239fc2"}
{"@t":"2019-10-30T14:11:36.7157274Z","@mt":"SQL [{ContextIndex}]: {Sql}","ContextIndex":696,"Sql":"CREATE NONCLUSTERED INDEX [IXumbracoPropertyDataPropertyTypeId] ON [umbracoPropertyData] ([propertyTypeId])","SourceContext":"Umbraco.Core.Migrations.Expressions.Execute.Expressions.ExecuteSqlStatementExpression","ProcessId":14144,"ProcessName":"w3wp","ThreadId":8,"AppDomainId":3,"AppDomainAppId":"LMW3SVC3ROOT","MachineName":"Umbraco","Log4NetLevel":"INFO ","HttpRequestNumber":7,"HttpRequestId":"1d4fbb3a-e2df-42e1-b32d-99edb8239fc2"}
{"@t":"2019-10-30T14:11:37.4919063Z","@mt":"SQL [{ContextIndex}]: {Sql}","ContextIndex":697,"Sql":"CREATE NONCLUSTERED INDEX [IXumbracoPropertyDataLanguageId] ON [umbracoPropertyData] ([languageId])","SourceContext":"Umbraco.Core.Migrations.Expressions.Execute.Expressions.ExecuteSqlStatementExpression","ProcessId":14144,"ProcessName":"w3wp","ThreadId":8,"AppDomainId":3,"AppDomainAppId":"LMW3SVC3ROOT","MachineName":"Umbraco","Log4NetLevel":"INFO ","HttpRequestNumber":7,"HttpRequestId":"1d4fbb3a-e2df-42e1-b32d-99edb8239fc2"}
{"@t":"2019-10-30T14:11:38.2903093Z","@mt":"SQL [{ContextIndex}]: {Sql}","ContextIndex":698,"Sql":"CREATE NONCLUSTERED INDEX [IXumbracoPropertyDataSegment] ON [umbracoPropertyData] ([segment])","SourceContext":"Umbraco.Core.Migrations.Expressions.Execute.Expressions.ExecuteSqlStatementExpression","ProcessId":14144,"ProcessName":"w3wp","ThreadId":8,"AppDomainId":3,"AppDomainAppId":"LMW3SVC3ROOT","MachineName":"Umbraco","Log4NetLevel":"INFO ","HttpRequestNumber":7,"HttpRequestId":"1d4fbb3a-e2df-42e1-b32d-99edb8239fc2"}
{"@t":"2019-10-30T14:11:39.0459944Z","@mt":"SQL [{ContextIndex}]: {Sql}","ContextIndex":699,"Sql":"ALTER TABLE [umbracoPropertyData] ADD CONSTRAINT [FKumbracoPropertyDataumbracoContentVersionid] FOREIGN KEY ([versionId]) REFERENCES [umbracoContentVersion] ([id])","SourceContext":"Umbraco.Core.Migrations.Expressions.Execute.Expressions.ExecuteSqlStatementExpression","ProcessId":14144,"ProcessName":"w3wp","ThreadId":8,"AppDomainId":3,"AppDomainAppId":"LMW3SVC3ROOT","MachineName":"Umbraco","Log4NetLevel":"INFO ","HttpRequestNumber":7,"HttpRequestId":"1d4fbb3a-e2df-42e1-b32d-99edb8239fc2"}
{"@t":"2019-10-30T14:14:28.3423177Z","@mt":"Exception ({InstanceId}).","@l":"Error","@x":"System.Data.SqlClient.SqlException (0x80131904): The ALTER TABLE statement conflicted with the FOREIGN KEY constraint \"FKumbracoPropertyDataumbracoContentVersionid\". The conflict occurred in database \"Sandbox\", table \"dbo.umbracoContentVersion\", column 'id'.\r\n at System.Data.SqlClient.SqlConnection.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 Umbraco.Core.Persistence.FaultHandling.RetryPolicy.ExecuteAction[TResult](Func1 func)\r\n at NPoco.Database.ExecuteNonQueryHelper(DbCommand cmd)\r\n at NPoco.Database.Execute(String sql, CommandType commandType, Object[] args)\r\nClientConnectionId:383e2442-0e50-4a10-a8d9-42a396b50ab3\r\nError Number:547,State:0,Class:16","InstanceId":"f0e8cfda","SourceContext":"Umbraco.Core.Persistence.UmbracoDatabase","ProcessId":14144,"ProcessName":"w3wp","ThreadId":8,"AppDomainId":3,"AppDomainAppId":"LMW3SVC3ROOT","MachineName":"Umbraco","Log4NetLevel":"ERROR","HttpRequestNumber":7,"HttpRequestId":"1d4fbb3a-e2df-42e1-b32d-99edb8239fc2"} {"@t":"2019-10-30T14:14:28.3763240Z","@mt":"Database configuration failed","@l":"Error","@x":"System.Data.SqlClient.SqlException (0x80131904): The ALTER TABLE statement conflicted with the FOREIGN KEY constraint \"FK_umbracoPropertyData_umbracoContentVersion_id\". The conflict occurred in database \"Sandbox\", table \"dbo.umbracoContentVersion\", column 'id'.\r\n at System.Data.SqlClient.SqlConnection.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(TaskCompletionSource1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)\r\n at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()\r\n at Umbraco.Core.Persistence.FaultHandling.RetryPolicy.ExecuteAction[TResult](Func
1 func)\r\n at NPoco.Database.ExecuteNonQueryHelper(DbCommand cmd)\r\n at NPoco.Database.Execute(String sql, CommandType commandType, Object[] args)\r\n at Umbraco.Core.Migrations.MigrationExpressionBase.ExecuteStatement(StringBuilder stmtBuilder)\r\n at Umbraco.Core.Migrations.MigrationExpressionBase.Execute()\r\n at Umbraco.Core.Migrations.Expressions.Create.KeysAndIndexes.CreateKeysAndIndexesBuilder.Do()\r\n at Umbraco.Core.Migrations.Upgrade.Common.CreateKeysAndIndexes.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)\r\nClientConnectionId:383e2442-0e50-4a10-a8d9-42a396b50ab3\r\nError Number:547,State:0,Class:16","SourceContext":"Umbraco.Core.Migrations.Install.DatabaseBuilder","ProcessId":14144,"ProcessName":"w3wp","ThreadId":8,"AppDomainId":3,"AppDomainAppId":"LMW3SVC3ROOT","MachineName":"Umbraco","Log4NetLevel":"ERROR","HttpRequestNumber":7,"HttpRequestId":"1d4fbb3a-e2df-42e1-b32d-99edb8239fc2"} {"@t":"2019-10-30T14:14:28.3894914Z","@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\ncmsPropertyData,cmsContent,cmsContentVersion,cmsContentXml,cmsDataType,cmsDataTypePreValues,umbracoDomains,cmsMedia,cmsTask,cmsTaskType,umbracoMigration,cmsPreviewXml,cmsDocument,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\ncmsPropertyData,id,cmsPropertyData,contentNodeId,cmsPropertyData,propertytypeid,cmsPropertyData,dataInt,cmsPropertyData,dataDate,cmsPropertyData,dataNvarchar,cmsPropertyData,dataNtext,cmsPropertyData,dataDecimal,cmsPropertyData,versionId,cmsContent,pk,cmsContent,nodeId,cmsContent,contentType,cmsTemplate,design,cmsMacro,macroScriptType,cmsMacro,macroScriptAssembly,cmsMacro,macroXSLT,cmsMacro,macroPython,cmsContentVersion,id,cmsContentVersion,ContentId,cmsContentVersion,VersionId,cmsContentVersion,VersionDate,cmsContentXml,nodeId,cmsContentXml,xml,cmsDataType,pk,cmsDataType,nodeId,cmsDataType,dbType,cmsDataType,propertyEditorAlias,cmsDataTypePreValues,id,cmsDataTypePreValues,datatypeNodeId,cmsDataTypePreValues,value,cmsDataTypePreValues,sortorder,cmsDataTypePreValues,alias,umbracoDomains,id,umbracoDomains,domainDefaultLanguage,umbracoDomains,domainRootStructureID,umbracoDomains,domainName,cmsMedia,nodeId,cmsMedia,versionId,cmsMedia,mediaPath,cmsTask,closed,cmsTask,id,cmsTask,taskTypeId,cmsTask,nodeId,cmsTask,parentUserId,cmsTask,userId,cmsTask,DateTime,cmsTask,Comment,cmsTaskType,id,cmsTaskType,alias,cmsTags,parentId,umbracoMigration,id,umbracoMigration,name,umbracoMigration,version,umbracoMigration,createDate,cmsPreviewXml,nodeId,cmsPreviewXml,versionId,cmsPreviewXml,timestamp,cmsPreviewXml,xml,cmsDocument,nodeId,cmsDocument,published,cmsDocument,documentUser,cmsDocument,versionId,cmsDocument,text,cmsDocument,releaseDate,cmsDocument,expireDate,cmsDocument,updateDate,cmsDocument,templateId,cmsDocument,newest,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\nFKcmsContentcmsContentTypenodeId,FKcmsContentumbracoNode,FKcmsContentTypeumbracoNode,FKcmsDataTypeumbracoNode,FKcmsDataTypePreValuescmsDataType,FKcmsDocumentcmsTemplate,FKcmsDocumentumbracoNode,FKcmsDocumentTypecmsContentType,FKcmsDocumentTypecmsTemplate,FKcmsDocumentTypeumbracoNode,FKcmsLanguageTextcmsDictionary,FKcmsMacroPropertycmsMacro,FKcmsMediacmsContentnodeId,FKcmsMediaumbracoNodeid,FKcmsMemberumbracoNode,FKcmsMember2MemberGroupcmsMember,FKcmsMember2MemberGroupumbracoNode,FKcmsMemberTypecmsContentType,FKcmsMemberTypeumbracoNode,FKcmsPropertyDatacmsPropertyType,FKcmsPropertyDataumbracoNode,FKcmsPropertyTypecmsContentType,FKcmsPropertyTypecmsDataType,FKcmsPropertyTypecmsTab,FKcmsTabcmsContentType,FKcmsTagscmsTags,FKcmsTaskcmsTaskType,FKcmsTaskumbracoNode,FKcmsTaskumbracoUser,FKcmsTaskumbracoUser1,FKumbracoDomainsumbracoNode,FKumbracoExternalLoginumbracoUserid,FKumbracoNodeumbracoNode,FKumbracoRedirectUrl,FKumbracoRelationumbracoRelationType,FKumbracoUser2NodeNotifyumbracoNode,FKumbracoUser2NodeNotifyumbracoUser,FKumbracoNodeumbracoNodeid,FKumbracoNodeumbracoUserid,FKcmsContentTypeumbracoNodeid,FKumbracoContentumbracoNodeid,FKumbracoContentcmsContentTypeNodeId,FKumbracoContentVersionumbracoContentnodeId,FKumbracoContentVersionumbracoUserid,FKumbracoMediaVersionumbracoContentVersionid,FKumbracoDocumentumbracoContentnodeId,FKcmsDocumentTypecmsContentTypenodeId,FKcmsDocumentTypeumbracoNodeid,FKcmsDocumentTypecmsTemplatenodeId,FKumbracoDataTypeumbracoNodeid,FKumbracoLanguageumbracoLanguageid,FKcmsLanguageTextcmsDictionaryid,FKumbracoDomainumbracoNodeid,FKumbracoLogumbracoUserid,FKcmsMacroPropertycmsMacroid,FKcmsMemberTypeumbracoNodeid,FKcmsMemberTypecmsContentTypenodeId,FKcmsMemberumbracoContentnodeId,FKcmsMember2MemberGroupcmsMembernodeId,FKcmsMember2MemberGroupumbracoNodeid,FKcmsPropertyTypeGroupcmsContentTypenodeId,FKcmsPropertyTypeumbracoDataTypenodeId,FKcmsPropertyTypecmsContentTypenodeId,FKcmsPropertyTypecmsPropertyTypeGroupid,FKumbracoPropertyDataumbracoContentVersionid,FKumbracoPropertyDatacmsPropertyTypeid,FKumbracoPropertyDataumbracoLanguageid,FKumbracoRelationumbracoRelationTypeid,FKcmsTagsumbracoLanguageid,FKcmsTagRelationshipcmsContent,FKcmsTagRelationshipcmsTagsid,FKcmsContentType2ContentTypeumbracoNodeparent,FKcmsContentType2ContentTypeumbracoNodechild,FKumbracoUser2NodeNotifyumbracoUserid,FKumbracoUser2NodeNotifyumbracoNodeid,FKumbracoRedirectUrlumbracoNodeuniqueID,FKcmsContentNuumbracoContentnodeId,FKumbracoDocumentVersionumbracoContentVersionid,FKumbracoDocumentVersioncmsTemplatenodeId,FKumbracoContentVersionCultureVariationumbracoContentVersionid,FKumbracoContentVersionCultureVariationumbracoLanguageid,FKumbracoContentVersionCultureVariationumbracoUserid,FKumbracoDocumentCultureVariationumbracoNodeid,FKumbracoDocumentCultureVariationumbracoLanguageid,FKumbracoContentScheduleumbracoContentnodeId,FKumbracoContentScheduleumbracoLanguageid,PKcmsContentVersio38996AB5,PKcmsContent,PKcmsContentPreviewXml,PKcmsContentXml,PKcmsDataType,PKcmsDataTypePreValues,PKcmsDocument,PKcmsMedia,PKcmsPropertyData,PKcmsTab,PKcmsTask,PKcmsTaskType,PKdomains,PKlanguage,PKmacro,PKmacroProperty,PKstructure,PKtemplates,PKumbracoMigrations,PKumbracoNode,PKcmsTemplate,PKumbracoContent,PKumbracoContentVersion,PKumbracoMediaVersion,PKumbracoDocument,PKumbracoDataType,PKumbracoLanguage,PKumbracoDomain,PKcmsMacro,PKcmsMacroProperty,PKcmsPropertyTypeGroup,PKumbracoPropertyData,PKcmsContentNu,PKumbracoDocumentVersion,PKumbracoKeyValue,PKumbracoContentVersionCultureVariation,PKumbracoDocumentCultureVariation,PKumbracoContentSchedule\r\n \r\nThe following indexes were found in the database, but are not in the current schema:\r\nIXcmsContent,IXIcon,IXcmsContentVersion,IXcmsContentVersionContentId,IXcmsDataType,IXcmsDictionary,IXcmsDocument,IXcmsDocumentnewest,IXcmsDocumentpublished,IXcmsMacroAlias,IXcmsMedia,IXcmsPropertyData3,IXcmsTaskType,IXcmsTemplate,IXumbracoMigration,IXumbracoNodeObjectType,IXumbracoNodeParentId,IXumbracoNodePath,IXumbracoNodeTrashed,IXumbracoNodeUniqueID,IXumbracoUser,IXumbracoUseruserLogin,IXumbracoNodeParentId,IXumbracoNodePath,IXumbracoNodeTrashed,IXumbracoNodeObjectType,IXcmsContentTypeicon,IXcmsTemplatenodeId,IXumbracoMediaVersion,IXumbracoDocumentPublished,IXumbracoLanguagefallbackLanguageId,IXcmsMacroPropertyAlias,IXumbracoPropertyDataVersionId,IXumbracoPropertyDataPropertyTypeId,IXumbracoPropertyDataLanguageId,IXumbracoPropertyDataSegment,IXcmsTagsLanguageId,IXumbracoUserLoginlastValidatedUtc,IXumbracoContentVersionCultureVariationVersionId,IXumbracoContentVersionCultureVariationLanguageId,IXumbracoDocumentCultureVariationNodeId,IXumbracoDocumentCultureVariationLanguageId\r\n \r\nThe following unknown constraints (Primary Keys, Foreign Keys and Indexes) were found in the database, but are not in the current schema:\r\ncmsTagscmsTagRelationship\r\n \r\n","SourceContext":"Umbraco.Core.Migrations.Install.DatabaseBuilder","ProcessId":14144,"ProcessName":"w3wp","ThreadId":8,"AppDomainId":3,"AppDomainAppId":"LMW3SVC3ROOT","MachineName":"Umbraco","Log4NetLevel":"INFO ","HttpRequestNumber":7,"HttpRequestId":"1d4fbb3a-e2df-42e1-b32d-99edb8239fc2"} {"@t":"2019-10-30T14:14:28.3923227Z","@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: The ALTER TABLE statement conflicted with the FOREIGN KEY constraint \"FKumbracoPropertyDataumbracoContentVersionid\". The conflict occurred in database \"Sandbox\", table \"dbo.umbracoContentVersion\", column 'id'.\n Please check log file for additional information (can be found in '/AppData/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.Thanks in advance for any help given to get past the above error...
Your database probably has rows in
cmsPropertyData
for version IDs which no longer exist. In v7 these won't do much harm other than taking up space, but v8 adds this constraint so you'll need to delete them.This should do the job:
Running the sql did affect 2 rows in the cmsPropertyData table. Thank you Steve!! I had actually run that particular SQL statements before during the failed migration but it did not work because I had to for instance run the following SQL or the migration would be stuck for hours running the fix was to run the stated SQL before the other "fixes" i.e before:
Thanks again Steve.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.