Skip to content

Fix failing v4.13.1 migration for H2 deployments that pre-date v4.11.0#5100

Merged
nscuro merged 1 commit intoDependencyTrack:masterfrom
nscuro:issue-4906-h2
Jul 3, 2025
Merged

Fix failing v4.13.1 migration for H2 deployments that pre-date v4.11.0#5100
nscuro merged 1 commit intoDependencyTrack:masterfrom
nscuro:issue-4906-h2

Conversation

@nscuro
Copy link
Copy Markdown
Member

@nscuro nscuro commented Jul 3, 2025

Description

Fixes failing v4.13.1 migration for H2 deployments that pre-date v4.11.0.

Addressed Issue

Relates to #4906

Additional Details

N/A

Checklist

  • I have read and understand the contributing guidelines
  • This PR fixes a defect, and I have provided tests to verify that the fix is effective
  • This PR implements an enhancement, and I have provided tests to verify that it works as intended
  • This PR introduces changes to the database model, and I have added corresponding update logic
  • This PR introduces new or alters existing behavior, and I have updated the documentation accordingly

@nscuro nscuro added this to the 4.14.0 milestone Jul 3, 2025
Copilot AI review requested due to automatic review settings July 3, 2025 20:33
@nscuro nscuro added defect Something isn't working backport/4.13.3 PRs to be backported to v4.13.3 labels Jul 3, 2025
@owasp-dt-bot
Copy link
Copy Markdown

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a migration error in v4.13.1 for H2 databases deployed before v4.11.0 by extending the NOT NULL constraint logic to H2 and adjusting SQL statements for each dialect.

  • Enforce NOT NULL constraint on POLICY_TAGS.TAG_ID for both H2 and MSSQL
  • Add H2-specific ALTER TABLE syntax and wrap MSSQL drop/create index steps in dialect checks
  • Retain existing logic for index recreation and primary key enforcement
Comments suppressed due to low confidence (1)

src/main/java/org/dependencytrack/upgrade/v4131/v4131Updater.java:76

  • MSSQL requires the ON clause in a DROP INDEX statement (e.g., DROP INDEX indexName ON POLICY_TAGS). Update this SQL to use the correct MSSQL syntax.
                                    DROP INDEX "POLICY_TAGS"."%s"

@codacy-production
Copy link
Copy Markdown

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.00% (target: -1.00%) (target: 70.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (e1fe99b) 24048 19443 80.85%
Head commit (83a7d82) 24048 (+0) 19443 (+0) 80.85% (+0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#5100) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

@nscuro nscuro merged commit 66ef1be into DependencyTrack:master Jul 3, 2025
11 of 12 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

backport/4.13.3 PRs to be backported to v4.13.3 defect Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants