[open-ils-commits] r19528 - trunk/Open-ILS/src/sql/Pg (senator)
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Feb 24 10:35:15 EST 2011
Author: senator
Date: 2011-02-24 10:35:12 -0500 (Thu, 24 Feb 2011)
New Revision: 19528
Modified:
trunk/Open-ILS/src/sql/Pg/1.6.1-2.0-upgrade-db.sql
Log:
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
Modified: trunk/Open-ILS/src/sql/Pg/1.6.1-2.0-upgrade-db.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/1.6.1-2.0-upgrade-db.sql 2011-02-23 22:22:32 UTC (rev 19527)
+++ trunk/Open-ILS/src/sql/Pg/1.6.1-2.0-upgrade-db.sql 2011-02-24 15:35:12 UTC (rev 19528)
@@ -18793,6 +18793,17 @@
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:
More information about the open-ils-commits
mailing list