I’m trying to deploy one of my projects and getting the following SQL error indicating a PK violation:
Error while executing SQL command in transaction 'http://octopus.numotion.com/octopus/api/deployments e8fbcabb6e6d443ca3b77e265ad25cd0': Violation of PRIMARY KEY constraint 'PK_Deployment_Id'. Cannot insert duplicate key in object 'dbo.Deployment'. The duplicate key value is (Deployments-4580). The statement has been terminated. The command being executed was: INSERT INTO dbo.[Deployment] (Name, Created, EnvironmentId, ProjectId, ReleaseId, ProjectGroupId, TaskId, ChannelId, TenantId, DeployedBy, DeployedToMachineIds, Id, JSON) values (@Name, @Created, @EnvironmentId, @ProjectId, @ReleaseId, @ProjectGroupId, @TaskId, @ChannelId, @TenantId, @DeployedBy, @DeployedToMachineIds, @Id, @JSON) SQL Error 2627 - Violation of PRIMARY KEY constraint 'PK_Deployment_Id'. Cannot insert duplicate key in object 'dbo.Deployment'. The duplicate key value is (Deployments-4580). The statement has been terminated.
I found a similar topic regarding the EventRelatedDocument table.* Unfortunately, this isn’t a simple INT IDENTITY, so I don’t think the solution there would apply directly. How can I stop this error occurring?