Task #7150
closedDo not have FK pointing to a main repo from a DistributionTree Variant
100%
Description
Since DistributionTree is tied to a Repository, we need to create a new DistributionTree for each.
In order to achieve that, we should introduce a new field repository_id
and have it as a unique index.
Also fix the Addon and Variant models to point to RpmRepository rather than the master model.
Migration is needed, during which a new DistributionTree will be created in case it belongs to multiple repos.
Make sure that only one DistributionTree can be in a repo by performing a check in finalize_repo_version. The newest (incoming) DistributionTree always wins.
All the current problems with Distribution Trees are due to the fact that they have a circular dependency from a Variant to a main repo a Distribution Tree belongs to. The main tree needs to be managed by user like a normal RPM repo, so Distribution Tree Varian and the main repo should be detached. It also solves problems with copy of a DistributionTree and a repo deletion.
Related issues
Remove FK to the main repo from a distribution tree Variant.
No issues with repository removal. No issues with copying the same distribution tree into multiple repos.
closes #7150 https://pulp.plan.io/issues/7150
closes #7096 https://pulp.plan.io/issues/7096
closes #7046 https://pulp.plan.io/issues/7046
[nocoverage]