Allow reuse of project name and version when different parent project#1123
Allow reuse of project name and version when different parent project#1123jhoward-lm wants to merge 7 commits intoDependencyTrack:mainfrom
Conversation
|
@nscuro Do you think there are any changes to the models that will be needed to support this? |
|
I think an additional index is needed: CREATE UNIQUE INDEX "PROJECT_NAME_NULL_PARENT_NULL_VERSION_IDX"
ON "PROJECT" ("NAME")
WHERE "VERSION" IS NULL
AND "PARENT_PROJECT_ID" IS NULL; |
Upon initial look, there is this method which checks whether a given name-version combination already exists: This would need updating to take the parent project into consideration. We also have this The logic to retrieve all versions of a project is also solely based on the project name at the moment: There are multiple usages of this method, which retrieves a single project by name and version: |
You're right, I had already created it and testing locally now. Also, do the existing non-unique indexes |
They'd be covered with these new indexes so are safe to drop. |
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferences |
|
Going to defer this one until after resolution of #1121 and DependencyTrack/hyades#1736/DependencyTrack/hyades#1759 |
Signed-off-by: Jonathan Howard <jonathan.w.howard@lmco.com>
Co-authored-by: Niklas <nscuro@protonmail.com> Signed-off-by: jhoward-lm <140011346+jhoward-lm@users.noreply.github.com>
Signed-off-by: Jonathan Howard <jonathan.w.howard@lmco.com>
Signed-off-by: Jonathan Howard <jonathan.w.howard@lmco.com>
- add optional "parent" query param to ProjectResource.getProject - revert any non-required changes Signed-off-by: Jonathan Howard <jonathan.w.howard@lmco.com>
Signed-off-by: Jonathan Howard <jonathan.w.howard@lmco.com>
Signed-off-by: Jonathan Howard <jonathan.w.howard@lmco.com>
f2ac75e to
55cce1a
Compare
Description
This PR modifies the existing unique constraint on a project's combined name and version columns to include the parent project ID as an additional factor defining uniqueness.
The goal is to allow reuse of a project name, or project name and version, when the child projects have different parent projects.
--- title: New Behavior --- erDiagram p1["parent project"] { NAME parent-project VERSION v1 } p2["parent project"] { NAME parent-project VERSION v2 } c1["child project"] { NAME child-project VERSION v1 } c2["child project"] { NAME child-project VERSION v2 } c3["child project"] { NAME child-project VERSION v1 } c4["child project"] { NAME child-project VERSION v2 } p1 |o--o{ c1 : "parent of" p1 |o--o{ c2 : "parent of" p2 |o--o{ c3 : "parent of" p2 |o--o{ c4 : "parent of"Addressed Issue
Additional Details
Checklist