Skip to content

Commit

Permalink
[MODORDSTOR-379] - Manage updates of custom fields through RecordServ…
Browse files Browse the repository at this point in the history
…iceImpl (#384)

* Manage updates of custom fields through RecordServiceImpl

* Add indexes for RecordService queries
  • Loading branch information
alb3rtino authored Mar 8, 2024
1 parent d784609 commit 3966b10
Show file tree
Hide file tree
Showing 7 changed files with 580 additions and 35 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package org.folio.services.record;

import java.util.List;
import java.util.Map;

import org.folio.service.RecordService;
import org.folio.service.RecordServiceImpl;
import org.folio.service.spi.RecordServiceFactory;

import io.vertx.core.Vertx;

public class RecordServiceFactoryImpl implements RecordServiceFactory {

@Override
public RecordService create(Vertx vertx) {
return RecordServiceImpl.createForMultipleTables(
vertx,
Map.of(
"po_line",
List.of("po_line", "order_templates"),
"purchase_order",
List.of("purchase_order", "order_templates")));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.folio.services.record.RecordServiceFactoryImpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CREATE INDEX IF NOT EXISTS order_templates_customfields_recordservice_idx_gin
ON ${myuniversity}_${mymodule}.order_templates USING GIN ((jsonb->'customFields'));
2 changes: 2 additions & 0 deletions src/main/resources/templates/db_scripts/po_line_table.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CREATE INDEX IF NOT EXISTS po_line_customfields_recordservice_idx_gin
ON ${myuniversity}_${mymodule}.po_line USING GIN ((jsonb->'customFields'));
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ GRANT USAGE ON SEQUENCE ${myuniversity}_${mymodule}.po_number TO ${myuniversity}


CREATE UNIQUE INDEX IF NOT EXISTS purchase_order_po_number_unique_idx ON ${myuniversity}_${mymodule}.purchase_order ((jsonb->>'poNumber'));
CREATE INDEX IF NOT EXISTS purchase_order_customfields_recordservice_idx_gin
ON ${myuniversity}_${mymodule}.purchase_order USING GIN ((jsonb->'customFields'));

8 changes: 5 additions & 3 deletions src/main/resources/templates/db_scripts/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
},
{
"tableName": "purchase_order",
"fromModuleVersion": "mod-orders-storage-10.0.0",
"fromModuleVersion": "mod-orders-storage-13.7.0",
"withMetadata": true,
"customSnippetPath": "purchase_order_table.sql",
"index": [
Expand Down Expand Up @@ -230,8 +230,9 @@
},
{
"tableName": "po_line",
"fromModuleVersion": "mod-orders-storage-12.0.0",
"fromModuleVersion": "mod-orders-storage-13.7.0",
"withMetadata": true,
"customSnippetPath": "po_line_table.sql",
"foreignKeys": [
{
"fieldName": "purchaseOrderId",
Expand Down Expand Up @@ -608,8 +609,9 @@
},
{
"tableName": "order_templates",
"fromModuleVersion": "mod-orders-storage-8.0.0",
"fromModuleVersion": "mod-orders-storage-13.7.0",
"withMetadata": false,
"customSnippetPath": "order_templates_table.sql",
"uniqueIndex": [
{
"fieldName" : "templateName"
Expand Down
Loading

0 comments on commit 3966b10

Please sign in to comment.