LP#1253163: Replace dropped unique index, if we can user/dbwells/pg-93-authorities-index-rebase
authorDan Wells <dbw2@calvin.edu>
Mon, 17 Mar 2014 20:47:55 +0000 (16:47 -0400)
committerDan Wells <dbw2@calvin.edu>
Wed, 19 Mar 2014 02:35:38 +0000 (22:35 -0400)
Not sure if this is necessary, but since we drop this index, we might
want to make an effort to recreate it if we can (but don't die if we
cannot).

Signed-off-by: Dan Wells <dbw2@calvin.edu>
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.authority.in-line-headings.sql

index 64fe5f6..3b68093 100644 (file)
@@ -41,6 +41,12 @@ ALTER FUNCTION authority.simple_heading_set(TEXT) STABLE STRICT;
 
 COMMIT;
 
+\qecho .
+\qecho This index might fail, and is outside the transaction for that reason.
+\qecho If it fails, you probably did not have it in the first place.
+\qecho .
+CREATE UNIQUE INDEX unique_by_heading_and_thesaurus ON authority.record_entry (heading) WHERE deleted IS FALSE or deleted = FALSE;
+
 ALTER TABLE authority.record_entry ENABLE TRIGGER a_marcxml_is_well_formed;
 ALTER TABLE authority.record_entry ENABLE TRIGGER aaa_auth_ingest_or_delete;
 ALTER TABLE authority.record_entry ENABLE TRIGGER b_maintain_901;