Skip to content

engine-schema: add script to generate upgrade path changes - #14034

Draft
shwstppr wants to merge 1 commit into
apache:mainfrom
shapeblue:upgradepath-script
Draft

engine-schema: add script to generate upgrade path changes#14034
shwstppr wants to merge 1 commit into
apache:mainfrom
shapeblue:upgradepath-script

Conversation

@shwstppr

@shwstppr shwstppr commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Description

Given from and to versions the script will generate the basic upgrade path changes with Java class and schema upgrade and cleanup files.

Created #14033 changes with it.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

Given from and to versions the script will generate the basic upgrade path changes with Java class and schema upgrade and cleanup files.

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
@codecov

codecov Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 19.74%. Comparing base (8fb3ad4) to head (c077c7c).

Additional details and impacted files
@@            Coverage Diff            @@
##               main   #14034   +/-   ##
=========================================
  Coverage     19.73%   19.74%           
+ Complexity    19960    19959    -1     
=========================================
  Files          6371     6371           
  Lines        575784   575784           
  Branches      70478    70478           
=========================================
+ Hits         113659   113660    +1     
  Misses       449772   449772           
+ Partials      12353    12352    -1     
Flag Coverage Δ
uitests 3.41% <ø> (ø)
unittests 21.02% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Pull request overview

Adds a scaffolding script to generate a new engine-schema database upgrade path (Java upgrade class + schema/cleanup SQL files) and auto-wire it into DatabaseUpgradeChecker.java.

Changes:

  • Introduces engine/schema/create-upgrade-path.sh to generate upgrade artifacts for a given from/to version.
  • Auto-updates DatabaseUpgradeChecker.java by inserting a new Upgrade<from>to<to> import and a .next(...) entry.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

IMPORT_LINE="import com.cloud.upgrade.dao.${CLASS_NAME};"
FIRST_IMPORT_LINE=$(grep -n '^import com\.cloud\.upgrade\.dao\.Upgrade' "$CHECKER_FILE" | head -1 | cut -d: -f1)
LAST_IMPORT_LINE=$(grep -n '^import com\.cloud\.upgrade\.dao\.Upgrade' "$CHECKER_FILE" | tail -1 | cut -d: -f1)

Comment on lines +138 to +144
awk -v first="$FIRST_IMPORT_LINE" -v last="$LAST_IMPORT_LINE" -v importfile="$SORTED_IMPORTS_FILE" '
NR == first {
while ((getline line < importfile) > 0) print line
}
NR >= first && NR <= last { next }
{ print }
' "$CHECKER_FILE" > "$TMP_CHECKER"
awk -v prefix="$prefix" '{ if (length($0) == 0) print prefix; else print prefix " " $0 }' "$LICENSE_TEMPLATE"
}

LICENSE_JAVA="$(render_license "//")"
Comment on lines +89 to +91
cat > "$JAVA_FILE" <<EOF
${LICENSE_JAVA}
package com.cloud.upgrade.dao;
Comment on lines +147 to +152
awk -v nextline="$NEXT_LINE" '
/^[ \t]*\.build\(\);/ && !inserted {
print nextline
inserted = 1
}
{ print }
Comment on lines +153 to +154
' "$TMP_CHECKER" > "$CHECKER_FILE"
rm -f "$TMP_CHECKER"
@DaanHoogland DaanHoogland changed the title engine-schema: add script to generate upgrade path chages engine-schema: add script to generate upgrade path changes Sep 2, 2026
@DaanHoogland

Copy link
Copy Markdown
Contributor

can we change the example to 4.23.0 -> 24.0.0?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants