Skip to content

Add external_pull_request to existing_object_relations

What does this MR do?

#208128 (closed)

When project.json has ci_pipelines->external_pull_request and external_pull_requests, import will throw error

#<ActiveRecord::RecordNotUnique: PG::UniqueViolation: ERROR:  duplicate key value violates unique constraint "index_external_pull_requests_on_project_and_branches"
DETAIL:  Key (project_id, source_branch, target_branch)=(1, feature, master) already exists.

This is because of: when process_relation! process ci_pipelines, it saves ci_pipelines->external_pull_request in DB already. Later when process_relation! process external_pull_requests, it tries to save the same external_pull_request into DB.

We should handle external_pull_requests in the same way as labels and milestones, where it should find_or_create_object!

Conformity

Closes #208128 (closed)

Edited by Qingyu Zhao

Merge request reports