engine-schema: add script to generate upgrade path changes - #14034
engine-schema: add script to generate upgrade path changes#14034shwstppr wants to merge 1 commit into
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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.shto generate upgrade artifacts for a given from/to version. - Auto-updates
DatabaseUpgradeChecker.javaby inserting a newUpgrade<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) | ||
|
|
| 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 "//")" |
| cat > "$JAVA_FILE" <<EOF | ||
| ${LICENSE_JAVA} | ||
| package com.cloud.upgrade.dao; |
| awk -v nextline="$NEXT_LINE" ' | ||
| /^[ \t]*\.build\(\);/ && !inserted { | ||
| print nextline | ||
| inserted = 1 | ||
| } | ||
| { print } |
| ' "$TMP_CHECKER" > "$CHECKER_FILE" | ||
| rm -f "$TMP_CHECKER" |
|
can we change the example to 4.23.0 -> 24.0.0? |
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
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?