From 45acdabd93ffcdc7fb951dd7b7d9a42b61f577b6 Mon Sep 17 00:00:00 2001 From: Julian Ladisch Date: Thu, 26 Mar 2020 13:17:45 +0100 Subject: [PATCH] Smart index recreation: from 18.2.3/19.0.0/19.1.0 to >= 19.1.1 --- .../db_scripts/populateRmbInternalIndex.sql | 83 ++++++++++++++++++- 1 file changed, 79 insertions(+), 4 deletions(-) diff --git a/src/main/resources/templates/db_scripts/populateRmbInternalIndex.sql b/src/main/resources/templates/db_scripts/populateRmbInternalIndex.sql index 38fbc311a..772939314 100644 --- a/src/main/resources/templates/db_scripts/populateRmbInternalIndex.sql +++ b/src/main/resources/templates/db_scripts/populateRmbInternalIndex.sql @@ -7,8 +7,8 @@ BEGIN IF n > 0 THEN RETURN; END IF; - -- Edelweiss versions: 18.*.* (18.0.0 - 18.2.3) - IF regexp_match('${version}', '^(?:mod-inventory-storage-)?18\.') IS NOT NULL THEN + -- Edelweiss version 18.2.3 + IF regexp_match('${version}', '^(?:mod-inventory-storage-)?18\.2\.3') IS NOT NULL THEN INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('alternative_title_type_name_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS alternative_title_type_name_idx_unique ON ${myuniversity}_${mymodule}.alternative_title_type (lower(f_unaccent(jsonb->>''name'')))', false); INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('call_number_type_name_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS call_number_type_name_idx_unique ON ${myuniversity}_${mymodule}.call_number_type (lower(f_unaccent(jsonb->>''name'')))', false); INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('classification_type_name_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS classification_type_name_idx_unique ON ${myuniversity}_${mymodule}.classification_type (lower(f_unaccent(jsonb->>''name'')))', false); @@ -71,8 +71,13 @@ BEGIN INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('statistical_code_type_code_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS statistical_code_type_code_idx_unique ON ${myuniversity}_${mymodule}.statistical_code_type (lower(f_unaccent(jsonb->>''code'')))', false); RETURN; END IF; - -- 19.0.* or 19.1.0 - IF regexp_match('${version}', '^(?:mod-inventory-storage-)?(?:19\.0\.|19\.1\.0)') IS NOT NULL THEN + -- 19.0.0: Index rebuild is needed only for these 5 indexes when upgrading from 19.0.0 to 19.1.1: + -- holdings_record_callnumberandsuffix_idx + -- holdings_record_fullcallnumber_idx + -- instance_keyword_idx_ft + -- item_callnumberandsuffix_idx + -- item_fullcallnumber_idx + IF regexp_match('${version}', '^(?:mod-inventory-storage-)?19\.0\.0') IS NOT NULL THEN INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('alternative_title_type_name_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS alternative_title_type_name_idx_unique ON ${myuniversity}_${mymodule}.alternative_title_type (lower(f_unaccent(jsonb->>''name'')))', false); INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('call_number_type_name_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS call_number_type_name_idx_unique ON ${myuniversity}_${mymodule}.call_number_type (lower(f_unaccent(jsonb->>''name'')))', false); INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('classification_type_name_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS classification_type_name_idx_unique ON ${myuniversity}_${mymodule}.classification_type (lower(f_unaccent(jsonb->>''name'')))', false); @@ -136,4 +141,74 @@ BEGIN INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('statistical_code_type_code_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS statistical_code_type_code_idx_unique ON ${myuniversity}_${mymodule}.statistical_code_type (lower(f_unaccent(jsonb->>''code'')))', false); RETURN; END IF; + -- 19.1.0, there is no index change from 19.1.0 to 19.1.1 + IF regexp_match('${version}', '^(?:mod-inventory-storage-)?19\.1\.0') IS NOT NULL THEN + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('alternative_title_type_name_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS alternative_title_type_name_idx_unique ON ${myuniversity}_${mymodule}.alternative_title_type (lower(f_unaccent(jsonb->>''name'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('call_number_type_name_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS call_number_type_name_idx_unique ON ${myuniversity}_${mymodule}.call_number_type (lower(f_unaccent(jsonb->>''name'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('classification_type_name_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS classification_type_name_idx_unique ON ${myuniversity}_${mymodule}.classification_type (lower(f_unaccent(jsonb->>''name'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('contributor_name_type_name_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS contributor_name_type_name_idx_unique ON ${myuniversity}_${mymodule}.contributor_name_type (lower(f_unaccent(jsonb->>''name'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('contributor_type_code_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS contributor_type_code_idx_unique ON ${myuniversity}_${mymodule}.contributor_type (lower(f_unaccent(jsonb->>''code'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('contributor_type_name_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS contributor_type_name_idx_unique ON ${myuniversity}_${mymodule}.contributor_type (lower(f_unaccent(jsonb->>''name'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('electronic_access_relationship_name_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS electronic_access_relationship_name_idx_unique ON ${myuniversity}_${mymodule}.electronic_access_relationship (lower(f_unaccent(jsonb->>''name'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('holdings_note_type_name_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS holdings_note_type_name_idx_unique ON ${myuniversity}_${mymodule}.holdings_note_type (lower(f_unaccent(jsonb->>''name'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('holdings_record_callNumberAndSuffix_idx', 'CREATE INDEX IF NOT EXISTS holdings_record_callNumberAndSuffix_idx ON ${myuniversity}_${mymodule}.holdings_record (left(lower(concat_space_sql(holdings_record.jsonb->>''callNumber'' , holdings_record.jsonb->>''callNumberSuffix'')),600))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('holdings_record_callNumber_idx', 'CREATE INDEX IF NOT EXISTS holdings_record_callNumber_idx ON ${myuniversity}_${mymodule}.holdings_record (left(lower(jsonb->>''callNumber''),600))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('holdings_record_fullCallNumber_idx', 'CREATE INDEX IF NOT EXISTS holdings_record_fullCallNumber_idx ON ${myuniversity}_${mymodule}.holdings_record (left(lower(concat_space_sql(holdings_record.jsonb->>''callNumberPrefix'' , holdings_record.jsonb->>''callNumber'' , holdings_record.jsonb->>''callNumberSuffix'')),600))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('holdings_record_hrid_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS holdings_record_hrid_idx_unique ON ${myuniversity}_${mymodule}.holdings_record (lower(f_unaccent(jsonb->>''hrid'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('holdings_type_name_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS holdings_type_name_idx_unique ON ${myuniversity}_${mymodule}.holdings_type (lower(f_unaccent(jsonb->>''name'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('identifier_type_name_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS identifier_type_name_idx_unique ON ${myuniversity}_${mymodule}.identifier_type (lower(f_unaccent(jsonb->>''name'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('ill_policy_name_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS ill_policy_name_idx_unique ON ${myuniversity}_${mymodule}.ill_policy (lower(f_unaccent(jsonb->>''name'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('instance_classifications_idx_gin', 'CREATE INDEX IF NOT EXISTS instance_classifications_idx_gin ON ${myuniversity}_${mymodule}.instance USING GIN ((lower(f_unaccent(jsonb->>''classifications''))) gin_trgm_ops)', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('instance_contributors_idx', 'CREATE INDEX IF NOT EXISTS instance_contributors_idx ON ${myuniversity}_${mymodule}.instance (left(lower(f_unaccent(jsonb->>''contributors'')),600))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('instance_contributors_idx_ft', 'CREATE INDEX IF NOT EXISTS instance_contributors_idx_ft ON ${myuniversity}_${mymodule}.instance USING GIN ( to_tsvector(''simple'', f_unaccent(jsonb->>''contributors'')) )', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('instance_contributors_idx_gin', 'CREATE INDEX IF NOT EXISTS instance_contributors_idx_gin ON ${myuniversity}_${mymodule}.instance USING GIN ((lower(f_unaccent(jsonb->>''contributors''))) gin_trgm_ops)', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('instance_format_code_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS instance_format_code_idx_unique ON ${myuniversity}_${mymodule}.instance_format (lower(f_unaccent(jsonb->>''code'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('instance_format_name_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS instance_format_name_idx_unique ON ${myuniversity}_${mymodule}.instance_format (lower(f_unaccent(jsonb->>''name'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('instance_hrid_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS instance_hrid_idx_unique ON ${myuniversity}_${mymodule}.instance (lower(f_unaccent(jsonb->>''hrid'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('instance_identifiers_idx_ft', 'CREATE INDEX IF NOT EXISTS instance_identifiers_idx_ft ON ${myuniversity}_${mymodule}.instance USING GIN ( to_tsvector(''simple'', f_unaccent(jsonb->>''identifiers'')) )', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('instance_identifiers_idx_gin', 'CREATE INDEX IF NOT EXISTS instance_identifiers_idx_gin ON ${myuniversity}_${mymodule}.instance USING GIN ((lower(f_unaccent(jsonb->>''identifiers''))) gin_trgm_ops)', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('instance_indexTitle_idx', 'CREATE INDEX IF NOT EXISTS instance_indexTitle_idx ON ${myuniversity}_${mymodule}.instance (left(lower(f_unaccent(jsonb->>''indexTitle'')),600))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('instance_indexTitle_idx_gin', 'CREATE INDEX IF NOT EXISTS instance_indexTitle_idx_gin ON ${myuniversity}_${mymodule}.instance USING GIN ((lower(f_unaccent(jsonb->>''indexTitle''))) gin_trgm_ops)', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('instance_keyword_idx_ft', 'CREATE INDEX IF NOT EXISTS instance_keyword_idx_ft ON ${myuniversity}_${mymodule}.instance USING GIN ( to_tsvector(''simple'', f_unaccent(concat_space_sql(instance.jsonb->>''title'' , concat_array_object_values(instance.jsonb->''contributors'',''name'') , concat_array_object_values(instance.jsonb->''identifiers'',''value'')))) )', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('instance_languages_idx_ft', 'CREATE INDEX IF NOT EXISTS instance_languages_idx_ft ON ${myuniversity}_${mymodule}.instance USING GIN ( to_tsvector(''simple'', f_unaccent(jsonb->>''languages'')) )', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('instance_note_type_name_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS instance_note_type_name_idx_unique ON ${myuniversity}_${mymodule}.instance_note_type (lower(f_unaccent(jsonb->>''name'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('instance_publication_idx', 'CREATE INDEX IF NOT EXISTS instance_publication_idx ON ${myuniversity}_${mymodule}.instance (left(lower(f_unaccent(jsonb->>''publication'')),600))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('instance_relationship_type_name_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS instance_relationship_type_name_idx_unique ON ${myuniversity}_${mymodule}.instance_relationship_type (lower(f_unaccent(jsonb->>''name'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('instance_source_idx', 'CREATE INDEX IF NOT EXISTS instance_source_idx ON ${myuniversity}_${mymodule}.instance (left(lower(jsonb->>''source''),600))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('instance_statisticalCodeIds_idx', 'CREATE INDEX IF NOT EXISTS instance_statisticalCodeIds_idx ON ${myuniversity}_${mymodule}.instance (left(lower(jsonb->>''statisticalCodeIds''),600))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('instance_status_code_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS instance_status_code_idx_unique ON ${myuniversity}_${mymodule}.instance_status (lower(f_unaccent(jsonb->>''code'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('instance_status_name_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS instance_status_name_idx_unique ON ${myuniversity}_${mymodule}.instance_status (lower(f_unaccent(jsonb->>''name'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('instance_subjects_idx_gin', 'CREATE INDEX IF NOT EXISTS instance_subjects_idx_gin ON ${myuniversity}_${mymodule}.instance USING GIN ((lower(f_unaccent(jsonb->>''subjects''))) gin_trgm_ops)', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('instance_title_idx', 'CREATE INDEX IF NOT EXISTS instance_title_idx ON ${myuniversity}_${mymodule}.instance (left(lower(f_unaccent(jsonb->>''title'')),600))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('instance_title_idx_ft', 'CREATE INDEX IF NOT EXISTS instance_title_idx_ft ON ${myuniversity}_${mymodule}.instance USING GIN ( to_tsvector(''simple'', f_unaccent(jsonb->>''title'')) )', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('instance_title_idx_gin', 'CREATE INDEX IF NOT EXISTS instance_title_idx_gin ON ${myuniversity}_${mymodule}.instance USING GIN ((lower(f_unaccent(jsonb->>''title''))) gin_trgm_ops)', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('instance_type_code_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS instance_type_code_idx_unique ON ${myuniversity}_${mymodule}.instance_type (lower(f_unaccent(jsonb->>''code'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('instance_type_name_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS instance_type_name_idx_unique ON ${myuniversity}_${mymodule}.instance_type (lower(f_unaccent(jsonb->>''name'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('item_accessionNumber_idx', 'CREATE INDEX IF NOT EXISTS item_accessionNumber_idx ON ${myuniversity}_${mymodule}.item (left(lower(jsonb->>''accessionNumber''),600))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('item_barcode_idx', 'CREATE INDEX IF NOT EXISTS item_barcode_idx ON ${myuniversity}_${mymodule}.item (left(lower(f_unaccent(jsonb->>''barcode'')),600))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('item_barcode_idx_ft', 'CREATE INDEX IF NOT EXISTS item_barcode_idx_ft ON ${myuniversity}_${mymodule}.item USING GIN ( to_tsvector(''simple'', f_unaccent(jsonb->>''barcode'')) )', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('item_barcode_idx_gin', 'CREATE INDEX IF NOT EXISTS item_barcode_idx_gin ON ${myuniversity}_${mymodule}.item USING GIN ((lower(f_unaccent(jsonb->>''barcode''))) gin_trgm_ops)', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('item_callNumberAndSuffix_idx', 'CREATE INDEX IF NOT EXISTS item_callNumberAndSuffix_idx ON ${myuniversity}_${mymodule}.item (left(lower(concat_space_sql(item.jsonb->''effectiveCallNumberComponents''->>''callNumber'' , item.jsonb->''effectiveCallNumberComponents''->>''suffix'')),600))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('item_damaged_status_name_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS item_damaged_status_name_idx_unique ON ${myuniversity}_${mymodule}.item_damaged_status (lower(f_unaccent(jsonb->>''name'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('item_fullCallNumber_idx', 'CREATE INDEX IF NOT EXISTS item_fullCallNumber_idx ON ${myuniversity}_${mymodule}.item (left(lower(concat_space_sql(item.jsonb->''effectiveCallNumberComponents''->>''prefix'' , item.jsonb->''effectiveCallNumberComponents''->>''callNumber'' , item.jsonb->''effectiveCallNumberComponents''->>''suffix'')),600))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('item_hrid_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS item_hrid_idx_unique ON ${myuniversity}_${mymodule}.item (lower(f_unaccent(jsonb->>''hrid'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('item_note_type_name_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS item_note_type_name_idx_unique ON ${myuniversity}_${mymodule}.item_note_type (lower(f_unaccent(jsonb->>''name'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('item_status_name_idx', 'CREATE INDEX IF NOT EXISTS item_status_name_idx ON ${myuniversity}_${mymodule}.item (left(lower(f_unaccent(jsonb->''status''->>''name'')),600))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('item_status_name_idx_gin', 'CREATE INDEX IF NOT EXISTS item_status_name_idx_gin ON ${myuniversity}_${mymodule}.item USING GIN ((lower(f_unaccent(jsonb->''status''->>''name''))) gin_trgm_ops)', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('loan_type_name_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS loan_type_name_idx_unique ON ${myuniversity}_${mymodule}.loan_type (lower(f_unaccent(jsonb->>''name'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('location_code_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS location_code_idx_unique ON ${myuniversity}_${mymodule}.location (lower(f_unaccent(jsonb->>''code'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('location_name_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS location_name_idx_unique ON ${myuniversity}_${mymodule}.location (lower(f_unaccent(jsonb->>''name'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('loccampus_name_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS loccampus_name_idx_unique ON ${myuniversity}_${mymodule}.loccampus (lower(f_unaccent(jsonb->>''name'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('locinstitution_name_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS locinstitution_name_idx_unique ON ${myuniversity}_${mymodule}.locinstitution (lower(f_unaccent(jsonb->>''name'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('loclibrary_name_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS loclibrary_name_idx_unique ON ${myuniversity}_${mymodule}.loclibrary (lower(f_unaccent(jsonb->>''name'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('material_type_name_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS material_type_name_idx_unique ON ${myuniversity}_${mymodule}.material_type (lower(f_unaccent(jsonb->>''name'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('mode_of_issuance_name_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS mode_of_issuance_name_idx_unique ON ${myuniversity}_${mymodule}.mode_of_issuance (lower(f_unaccent(jsonb->>''name'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('nature_of_content_term_name_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS nature_of_content_term_name_idx_unique ON ${myuniversity}_${mymodule}.nature_of_content_term (lower(f_unaccent(jsonb->>''name'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('service_point_code_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS service_point_code_idx_unique ON ${myuniversity}_${mymodule}.service_point (lower(f_unaccent(jsonb->>''code'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('service_point_name_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS service_point_name_idx_unique ON ${myuniversity}_${mymodule}.service_point (lower(f_unaccent(jsonb->>''name'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('service_point_user_userId_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS service_point_user_userId_idx_unique ON ${myuniversity}_${mymodule}.service_point_user (lower(f_unaccent(jsonb->>''userId'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('statistical_code_code_statisticalCodeTypeId_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS statistical_code_code_statisticalCodeTypeId_idx_unique ON ${myuniversity}_${mymodule}.statistical_code (lower(f_unaccent(jsonb->>''code'')) , lower(f_unaccent(jsonb->>''statisticalCodeTypeId'')))', false); + INSERT INTO ${myuniversity}_${mymodule}.rmb_internal_index VALUES ('statistical_code_type_code_idx_unique', 'CREATE UNIQUE INDEX IF NOT EXISTS statistical_code_type_code_idx_unique ON ${myuniversity}_${mymodule}.statistical_code_type (lower(f_unaccent(jsonb->>''code'')))', false); + RETURN; + END IF; END $$;