Issue #8329

Updated by ttereshc about 3 years ago

Pulp2Content model has a FK to Pulp2Repository as a part of the uniqueness constraint on the model.   
 The FK can be null, because it is set only for content types which depend on a repo and can be associated only with one of them. 
 Since each null is unique, it creates duplicated entries, if something changed about this content in pulp2. 

 ### To reproduce 

  - migrate pulp2 rpm on_demand content 
  - download that content in pulp2 
  - run migration again 

 ### Solution 

  - Remove FK from the uniqueness constraint 
  - set pulp2_subuid to a repo_id value where an FK to a repo has been set 
  - data migration is needed