Add migrations for beneficiary residence columns and diagnostic devic… - #144
Conversation
…e integration tables
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds idempotent ChangesBeneficiary identity schema
Diagnostic device integration schema
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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.
Inline comments:
In `@src/main/resources/db/migration/dbidentity/V19_Non_Household_Add_Column.sql`:
- Around line 16-27: The migration’s six column-exists no-op branches use
double-quoted strings, which are invalid as SQL literals under ANSI_QUOTES. In
src/main/resources/db/migration/dbidentity/V19_Non_Household_Add_Column.sql,
update the fallback SELECT expressions in the dynamic SQL blocks at lines 16-27,
30-41, 44-55, 62-73, 76-87, and 90-101 to use single-quoted message literals,
preserving the existing ALTER TABLE branches.
In `@src/main/resources/db/migration/dbiemr/V96_Device_Integration.sql`:
- Around line 25-58: Remove IF NOT EXISTS from the CREATE TABLE statements for
tb_diagnostic_order
(src/main/resources/db/migration/dbiemr/V96_Device_Integration.sql#L25-L58),
tb_diagnostic_result (`#L64-L82`), tb_diagnostic_document (`#L88-L112`), and
tb_diagnostic_provider_token (`#L118-L128`), so V96 fails when any pre-existing
table has an incompatible schema.
- Line 122: Update the token storage associated with token_value so provider
bearer tokens are never persisted as plaintext. Use the existing secrets-manager
integration or encrypt the value with an application-managed/KMS-backed key
before database persistence, ensuring the database stores only ciphertext and
access is restricted appropriately.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 34bcf09a-1a58-4867-9fde-30bbf2130937
📒 Files selected for processing (2)
src/main/resources/db/migration/dbidentity/V19_Non_Household_Add_Column.sqlsrc/main/resources/db/migration/dbiemr/V96_Device_Integration.sql
|
|
Some of these create table definition do not contain sync related column. |
|


Add two new Flyway migrations:
db_identity V19: Adds placeOfCurrentLiving, otherPlaceOfCurrentLiving,
and institutionName columns to i_beneficiarydetails and
i_beneficiarydetails_rmnch to capture a beneficiary's current place
of residence. Idempotent — checks INFORMATION_SCHEMA before altering
so it is safe to re-run.
db_iemr V96: Creates the schema for diagnostic device integration —
tb_diagnostic_order (orders sent to external diagnostic providers),
tb_diagnostic_result (results per order), tb_diagnostic_document
(reports/files linked to a result), and
tb_diagnostic_provider_token (auth tokens for provider APIs). Uses
CREATE TABLE IF NOT EXISTS, so re-running is safe; future schema
changes should ship as separate ALTER migrations.
Summary by CodeRabbit
New Features
Bug Fixes
isGpsUnavailableis normalized consistently across affected tables when present.