Migration Failed- Init Database : The ALTER TABLE Statement Conflicted With The FOREIGN KEY Constraint

How to troubleshoot error Migration failed: Init Database: The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK_dbo.AuditLogEntities_dbo.AuditLogs_AuditLogId"?

Resolution: Try to restore DB from a backup. If that does not resolve the issue, then execute the below queries on the UiPath Orchestrator DB and try again.
Note : Database backup is necessary before performing any operations on it.


FROM dbo.AuditLogs where dbo.AuditLogs.Id In (SELECT Id From dbo.AuditLogs AS c


FROM dbo.AuditLogEntities AS p

WHERE p.AuditLogId = c.Id));

Delete from dbo.AuditLogEntities where dbo.AuditLogEntities.AuditLogId not in (select id from dbo.AuditLogs)