Skip to content

Commit

Permalink
feat(indexing): Update tenant_id in database during event processing (#…
Browse files Browse the repository at this point in the history
…730)

Closes: MSEARCH-877
  • Loading branch information
psmagin authored Jan 7, 2025
1 parent 1204500 commit 3e306ed
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* Fix generation of IDs ranges in Reindex Upload for Subject, Classification and Contributor ([MSEARCH-907](https://folio-org.atlassian.net/browse/MSEARCH-907))
* Remove browse config caching ([MSEARCH-897](https://folio-org.atlassian.net/browse/MSEARCH-897))
* Fix the "Invalid reference" appears after updating ownership ([MSEARCH-915](https://folio-org.atlassian.net/browse/MSEARCH-915))
* Update tenant_id in database during event processing ([MSEARCH-877](https://folio-org.atlassian.net/browse/MSEARCH-877))
* Fix an issue with interrupting the batch event processing due to SystemUserAuthorizationException ([MSEARCH-925](https://folio-org.atlassian.net/browse/MSEARCH-925))

### Tech Dept
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class HoldingRepository extends MergeRangeRepository {
ON CONFLICT (id, tenant_id)
DO UPDATE SET
instance_id = EXCLUDED.instance_id,
tenant_id = EXCLUDED.tenant_id,
json = EXCLUDED.json;
""";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ ON CONFLICT (id, tenant_id)
DO UPDATE SET
instance_id = EXCLUDED.instance_id,
holding_id = EXCLUDED.holding_id,
tenant_id = EXCLUDED.tenant_id,
json = EXCLUDED.json;
""";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class MergeInstanceRepository extends MergeRangeRepository {
VALUES (?::uuid, ?, ?, ?, ?::jsonb)
ON CONFLICT (id)
DO UPDATE SET shared = EXCLUDED.shared,
tenant_id = EXCLUDED.tenant_id,
is_bound_with = EXCLUDED.is_bound_with,
json = EXCLUDED.json;
""";
Expand Down Expand Up @@ -79,6 +80,6 @@ public void saveEntities(String tenantId, List<Map<String, Object>> entities) {
public void updateBoundWith(String tenantId, String id, boolean bound) {
var fullTableName = getFullTableName(context, entityTable());
var sql = UPDATE_BOUND_WITH_SQL.formatted(fullTableName);
jdbcTemplate.update(sql, bound /*? "true" : "false"*/, id);
jdbcTemplate.update(sql, bound, id);
}
}

0 comments on commit 3e306ed

Please sign in to comment.