From: senator Date: Thu, 24 Feb 2011 15:35:12 +0000 (+0000) Subject: Per Robert Soulliere, it can be necessary in some cases to clean out bad X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=0e3a6a48eac948562eab6491441d674a87544f9e;p=evergreen%2Ftadl.git Per Robert Soulliere, it can be necessary in some cases to clean out bad data from action.reservation_transit_copy before applying the missing fkeys to said table. https://bugs.launchpad.net/evergreen/+bug/721450 git-svn-id: svn://svn.open-ils.org/ILS/trunk@19528 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- 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 9d8e8c4306..6fb8039f29 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 @@ -18793,6 +18793,17 @@ ALTER TABLE acq.provider_contact ALTER TABLE actor.stat_cat ADD COLUMN usr_summary BOOL NOT NULL DEFAULT FALSE; +-- Per Robert Soulliere, it can be necessary in some cases to clean out bad +-- data from action.reservation_transit_copy before applying the missing +-- fkeys below. +-- https://bugs.launchpad.net/evergreen/+bug/721450 +DELETE FROM action.reservation_transit_copy + WHERE target_copy NOT IN (SELECT id FROM booking.resource); +-- In the same spirit as the above delete, this can only fix bad data. +UPDATE action.reservation_transit_copy + SET reservation = NULL + WHERE reservation NOT IN (SELECT id FROM booking.reservation); + -- Recreate some foreign keys that were somehow dropped, probably -- by some kind of cascade from an inherited table: