From 0fc4ce7d75a2cfe39918b6834c284feda8fd4610 Mon Sep 17 00:00:00 2001 From: miker Date: Mon, 21 Feb 2011 15:39:29 +0000 Subject: [PATCH] Addressing LP bug: https://bugs.launchpad.net/evergreen/+bug/721450 If a series-class index definition has been removed, the data remains in the field entry table. This is because there was no fkey previously. We need to clean that data out so that the fkey can be validated during upgrade. git-svn-id: svn://svn.open-ils.org/ILS/trunk@19494 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/sql/Pg/1.6.1-2.0-upgrade-db.sql | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Open-ILS/src/sql/Pg/1.6.1-2.0-upgrade-db.sql b/Open-ILS/src/sql/Pg/1.6.1-2.0-upgrade-db.sql index aac25cc909..9d8e8c4306 100644 --- a/Open-ILS/src/sql/Pg/1.6.1-2.0-upgrade-db.sql +++ b/Open-ILS/src/sql/Pg/1.6.1-2.0-upgrade-db.sql @@ -14892,6 +14892,10 @@ CREATE INDEX claim_lid_idx ON acq.claim( lineitem_detail ); CREATE OR REPLACE RULE protect_bib_rec_delete AS ON DELETE TO biblio.record_entry DO INSTEAD (UPDATE biblio.record_entry SET deleted = TRUE WHERE OLD.id = biblio.record_entry.id; DELETE FROM metabib.metarecord_source_map WHERE source = OLD.id); +-- remove invalid data ... there was no fkey before, boo +DELETE FROM metabib.series_field_entry WHERE source NOT IN (SELECT id FROM biblio.record_entry); +DELETE FROM metabib.series_field_entry WHERE field NOT IN (SELECT id FROM config.metabib_field); + CREATE INDEX metabib_title_field_entry_value_idx ON metabib.title_field_entry (SUBSTRING(value,1,1024)) WHERE index_vector = ''::TSVECTOR; CREATE INDEX metabib_author_field_entry_value_idx ON metabib.author_field_entry (SUBSTRING(value,1,1024)) WHERE index_vector = ''::TSVECTOR; CREATE INDEX metabib_subject_field_entry_value_idx ON metabib.subject_field_entry (SUBSTRING(value,1,1024)) WHERE index_vector = ''::TSVECTOR; -- 2.11.0