Skip to content

Update db_upgrade_scripts with dynamic db changes#1758

Open
abhishek8shankar wants to merge 2 commits into
mosip:developfrom
abhishek8shankar:develop-upgrade
Open

Update db_upgrade_scripts with dynamic db changes#1758
abhishek8shankar wants to merge 2 commits into
mosip:developfrom
abhishek8shankar:develop-upgrade

Conversation

@abhishek8shankar

@abhishek8shankar abhishek8shankar commented Jun 17, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Chores
    • Updated database configuration property naming in upgrade scripts for consistency.
    • Enhanced upgrade process to display version information and variables during execution for improved visibility into the deployment process.

Signed-off-by: abhishek8shankar <abhishek.shankarcs@gmail.com>
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@abhishek8shankar, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 40 minutes and 44 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 44a1b4c9-c533-4aa7-b051-2976ca9bc0c6

📥 Commits

Reviewing files that changed from the base of the PR and between 31a46eb and 4ed50d3.

📒 Files selected for processing (1)
  • db_upgrade_scripts/mosip_ida/upgrade.sh

Walkthrough

upgrade.properties renames the MOSIP_DB_NAME property to DB_UNAME. upgrade.sh adds logging of CURRENT_VERSION, UPGRADE_VERSION, and ACTION, and updates both the upgrade and rollback psql invocations to pass db_name=$MOSIP_DB_NAME and ida_user=$DB_UNAME as SQL variables.

Changes

DB Upgrade Script Variable Passing

Layer / File(s) Summary
Property rename and psql variable passing
db_upgrade_scripts/mosip_ida/upgrade.properties, db_upgrade_scripts/mosip_ida/upgrade.sh
MOSIP_DB_NAME property key renamed to DB_UNAME in the properties file; both the upgrade and rollback psql commands updated to supply -v db_name=$MOSIP_DB_NAME and -v ida_user=$DB_UNAME to the executed SQL scripts.
Version logging and error control flow
db_upgrade_scripts/mosip_ida/upgrade.sh
Added echo statements printing resolved CURRENT_VERSION, UPGRADE_VERSION, and ACTION before execution; terminal else branch updated to print an error and exit on unknown actions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Poem

🐇 A property key changed its name one fine day,
From MOSIP_DB_NAME to DB_UNAME — hooray!
The psql now carries both db_name and user,
The versions get logged to make the path clearer.
Hop hop, little script, now you're good to deploy! 🌿

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Update db_upgrade_scripts with dynamic db changes' is vague and generic, using non-descriptive terms like 'dynamic db changes' that lack specific detail about what actually changed. Make the title more specific by describing the actual changes, such as 'Add db_name and ida_user variables to upgrade scripts' or 'Replace MOSIP_DB_NAME with DB_UNAME configuration'.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
db_upgrade_scripts/mosip_ida/upgrade.sh (1)

29-29: ⚡ Quick win

Quote psql variable expansions to avoid argument splitting.

Line 29 and Line 39 currently use unquoted expansions ($MOSIP_DB_NAME, $DB_UNAME, script path). Quote them so psql receives stable arguments even with unexpected characters.

Proposed patch
-    PGPASSWORD=$SU_USER_PWD psql -v ON_ERROR_STOP=1 -v db_name=$MOSIP_DB_NAME -v ida_user=$DB_UNAME --username=$SU_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -a -b -f $UPGRADE_SCRIPT_FILE
+    PGPASSWORD="$SU_USER_PWD" psql -v ON_ERROR_STOP=1 -v "db_name=$MOSIP_DB_NAME" -v "ida_user=$DB_UNAME" --username="$SU_USER" --host="$DB_SERVERIP" --port="$DB_PORT" --dbname="$DEFAULT_DB_NAME" -a -b -f "$UPGRADE_SCRIPT_FILE"
@@
-    PGPASSWORD=$SU_USER_PWD psql -v ON_ERROR_STOP=1 -v db_name=$MOSIP_DB_NAME -v ida_user=$DB_UNAME --username=$SU_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -a -b -f $REVOKE_SCRIPT_FILE
+    PGPASSWORD="$SU_USER_PWD" psql -v ON_ERROR_STOP=1 -v "db_name=$MOSIP_DB_NAME" -v "ida_user=$DB_UNAME" --username="$SU_USER" --host="$DB_SERVERIP" --port="$DB_PORT" --dbname="$DEFAULT_DB_NAME" -a -b -f "$REVOKE_SCRIPT_FILE"

Also applies to: 39-39

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@db_upgrade_scripts/mosip_ida/upgrade.sh` at line 29, The psql command on line
29 has unquoted variable expansions for $MOSIP_DB_NAME, $DB_UNAME, and
$UPGRADE_SCRIPT_FILE which can cause argument splitting if these variables
contain spaces or special characters. Quote each variable expansion in the psql
command by wrapping them with double quotes, so that -v db_name=$MOSIP_DB_NAME
becomes -v db_name="$MOSIP_DB_NAME", -v ida_user=$DB_UNAME becomes -v
ida_user="$DB_UNAME", and -f $UPGRADE_SCRIPT_FILE becomes -f
"$UPGRADE_SCRIPT_FILE". Apply the same quoting fix to line 39 which has the same
pattern.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@db_upgrade_scripts/mosip_ida/upgrade.sh`:
- Line 29: The psql command on line 29 has unquoted variable expansions for
$MOSIP_DB_NAME, $DB_UNAME, and $UPGRADE_SCRIPT_FILE which can cause argument
splitting if these variables contain spaces or special characters. Quote each
variable expansion in the psql command by wrapping them with double quotes, so
that -v db_name=$MOSIP_DB_NAME becomes -v db_name="$MOSIP_DB_NAME", -v
ida_user=$DB_UNAME becomes -v ida_user="$DB_UNAME", and -f $UPGRADE_SCRIPT_FILE
becomes -f "$UPGRADE_SCRIPT_FILE". Apply the same quoting fix to line 39 which
has the same pattern.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4b627b8d-2bc1-4d55-b021-f7063ac7d60e

📥 Commits

Reviewing files that changed from the base of the PR and between c675c78 and 31a46eb.

📒 Files selected for processing (2)
  • db_upgrade_scripts/mosip_ida/upgrade.properties
  • db_upgrade_scripts/mosip_ida/upgrade.sh

Signed-off-by: abhishek8shankar <abhishek.shankarcs@gmail.com>
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.

1 participant