From c03a0854f7f836dae6ea8ad14d9f9e2651373811 Mon Sep 17 00:00:00 2001 From: senator Date: Thu, 24 Feb 2011 15:36:18 +0000 Subject: [PATCH] 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/branches/rel_2_1@19530 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/sql/Pg/1.6.1-2.0-upgrade-db.sql | 11 +++++++++++ 1 file changed, 11 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 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: -- 2.11.0