From: Jason Stephenson Date: Thu, 6 Aug 2015 15:13:00 +0000 (-0400) Subject: LP#1479953: Rename indexes to *_idx and add pgTAP test. X-Git-Tag: sprint4-merge-nov22~1282 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=57d756fb33f225233fa73d3dffc6f1d32b4b31d1;p=working%2FEvergreen.git LP#1479953: Rename indexes to *_idx and add pgTAP test. To make the new index names more consistent with existing indices, I took the liberty of adding _idx to the new index names. We also add a pgTAP test to verify that the new indices exist in the database. The test would fail before running the upgrade script and succeed after. Signed-off-by: Jason Stephenson --- diff --git a/Open-ILS/src/sql/Pg/012.schema.vandelay.sql b/Open-ILS/src/sql/Pg/012.schema.vandelay.sql index 25e1a6dc8d..27eb5287b0 100644 --- a/Open-ILS/src/sql/Pg/012.schema.vandelay.sql +++ b/Open-ILS/src/sql/Pg/012.schema.vandelay.sql @@ -150,7 +150,7 @@ CREATE TABLE vandelay.bib_match ( quality INT NOT NULL DEFAULT 1, match_score INT NOT NULL DEFAULT 0 ); -CREATE INDEX bib_match_queued_record ON vandelay.bib_match (queued_record); +CREATE INDEX bib_match_queued_record_idx ON vandelay.bib_match (queued_record); CREATE TABLE vandelay.import_item ( id BIGSERIAL PRIMARY KEY, @@ -181,7 +181,7 @@ CREATE TABLE vandelay.import_item ( opac_visible BOOL, internal_id BIGINT -- queue_type == 'acq' ? acq.lineitem_detail.id : asset.copy.id ); -CREATE INDEX import_item_record ON vandelay.import_item (record); +CREATE INDEX import_item_record_idx ON vandelay.import_item (record); CREATE TABLE vandelay.import_bib_trash_group( id SERIAL PRIMARY KEY, diff --git a/Open-ILS/src/sql/Pg/200.schema.acq.sql b/Open-ILS/src/sql/Pg/200.schema.acq.sql index 9c9f9e5163..2741ebce08 100644 --- a/Open-ILS/src/sql/Pg/200.schema.acq.sql +++ b/Open-ILS/src/sql/Pg/200.schema.acq.sql @@ -489,7 +489,7 @@ CREATE INDEX li_pl_idx ON acq.lineitem (picklist); CREATE INDEX li_creator_idx ON acq.lineitem ( creator ); CREATE INDEX li_editor_idx ON acq.lineitem ( editor ); CREATE INDEX li_selector_idx ON acq.lineitem ( selector ); -CREATE INDEX li_queued_record ON acq.lineitem ( queued_record ); +CREATE INDEX li_queued_record_idx ON acq.lineitem ( queued_record ); CREATE TABLE acq.lineitem_alert_text ( id SERIAL PRIMARY KEY, diff --git a/Open-ILS/src/sql/Pg/201.acq.audit-functions.sql b/Open-ILS/src/sql/Pg/201.acq.audit-functions.sql index 383e29fa4d..c9d17b6ce7 100644 --- a/Open-ILS/src/sql/Pg/201.acq.audit-functions.sql +++ b/Open-ILS/src/sql/Pg/201.acq.audit-functions.sql @@ -103,6 +103,6 @@ CREATE INDEX acq_po_hist_id_idx ON acq.acq_purchase_order_history( id SELECT acq.create_acq_auditor ( 'acq', 'lineitem' ); CREATE INDEX acq_lineitem_hist_id_idx ON acq.acq_lineitem_history( id ); -CREATE INDEX acq_lineitem_history_queued_record ON acq.acq_lineitem_history (queued_record); +CREATE INDEX acq_lineitem_history_queued_record_idx ON acq.acq_lineitem_history (queued_record); COMMIT; diff --git a/Open-ILS/src/sql/Pg/t/regress/lp1479953_has_indexes.pg b/Open-ILS/src/sql/Pg/t/regress/lp1479953_has_indexes.pg new file mode 100644 index 0000000000..0921d615b9 --- /dev/null +++ b/Open-ILS/src/sql/Pg/t/regress/lp1479953_has_indexes.pg @@ -0,0 +1,10 @@ +BEGIN; + +SELECT plan(4); + +SELECT has_index('acq', 'acq_lineitem_history', 'acq_lineitem_history_queued_record_idx', ARRAY['queued_record']); +SELECT has_index('acq', 'lineitem', 'li_queued_record_idx', ARRAY['queued_record']); +SELECT has_index('vandelay', 'bib_match', 'bib_match_queued_record_idx', ARRAY['queued_record']); +SELECT has_index('vandelay', 'import_item', 'import_item_record_idx', ARRAY['record']); + +ROLLBACK; diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.index.queued_record.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.index.queued_record.sql index 4ca13c74cb..a1fb2c2a14 100644 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.index.queued_record.sql +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.index.queued_record.sql @@ -7,9 +7,9 @@ BEGIN; SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version); -CREATE INDEX acq_lineitem_history_queued_record ON acq.acq_lineitem_history (queued_record); -CREATE INDEX li_queued_record ON acq.lineitem (queued_record); -CREATE INDEX bib_match_queued_record ON vandelay.bib_match (queued_record); -CREATE INDEX import_item_record ON vandelay.import_item (record); +CREATE INDEX acq_lineitem_history_queued_record_idx ON acq.acq_lineitem_history (queued_record); +CREATE INDEX li_queued_record_idx ON acq.lineitem (queued_record); +CREATE INDEX bib_match_queued_record_idx ON vandelay.bib_match (queued_record); +CREATE INDEX import_item_record_idx ON vandelay.import_item (record); COMMIT;