Uploaded image for project: 'RAML Module Builder'
  1. RAML Module Builder
  2. RMB-688

PATCH to update only some JSONB properties

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Open (View Workflow)
    • Priority: P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Template:
    • Sprint:
      CP: Non-roadmap backlog
    • Development Team:
      Core: Platform

      Description

      Some institutions need to bulk update the user records with data from the central administration. Only some fields of user records should be updated.

      MODKBEKBJ-447 has already implemented a PATCH.

      There are other use cases.

      PostgreSQL syntax:

      UPDATE users SET jsonb = jsonb_set(jsonb_set(jsonb, 
              '{active}', 'true'), 
              '{patronGroup}', '4bb563d9-3f9d-4e1e-8d1d-04e75666d68f')
      WHERE id = '7261ecaae3a74dc68b468e12a70b1aec';
      

      This sets "active" and "patronGroup" only, all other properties remain unchanged.

      PostgreSQL has the - operator to delete a jsonb property, and PostgreSQL 13 has the jsonb_set_lax function that also can delete nested jsonb properties.

      RMB has a method that can update a single jsonb property using jsonb_set: https://github.com/folio-org/raml-module-builder/blob/v30.2.4/domain-models-runtime/src/main/java/org/folio/rest/persist/PostgresClient.java#L1325-L1360

      Task:
      Create a PostgresClient method that can update and/or delete multiple jsonb properties.
      Create a PgUtil PATCH method that uses it.

        TestRail: Results

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                Unassigned Unassigned
                Reporter:
                julianladisch Julian Ladisch
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                  Dates

                  Created:
                  Updated:

                    TestRail: Runs

                      TestRail: Cases