Restore two foreign keys that were somehow inadvertently
authorscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 17 Sep 2010 19:12:05 +0000 (19:12 +0000)
committerscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 17 Sep 2010 19:12:05 +0000 (19:12 +0000)
dropped, probably by some funky interaction with inheritance.

M    Open-ILS/src/sql/Pg/1.6.1-2.0-upgrade-db.sql

git-svn-id: svn://svn.open-ils.org/ILS/trunk@17775 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/sql/Pg/1.6.1-2.0-upgrade-db.sql

index 83a2c63..1ce8881 100644 (file)
@@ -3,7 +3,7 @@ BEGIN;
 -- Highest-numbered individual upgrade script
 -- incorporated herein:
 
-INSERT INTO config.upgrade_log (version) VALUES ('0405');
+INSERT INTO config.upgrade_log (version) VALUES ('0403');
 
 -- Begin by upgrading permission.perm_list.  This is fairly complicated.
 
@@ -17864,6 +17864,19 @@ ALTER TABLE acq.provider_contact
 ALTER TABLE actor.stat_cat
        ADD COLUMN usr_summary BOOL NOT NULL DEFAULT FALSE;
 
+-- Recreate some foreign keys that were somehow dropped, probably
+-- by some kind of cascade from an inherited table:
+
+ALTER TABLE action.reservation_transit_copy
+       ADD CONSTRAINT artc_tc_fkey FOREIGN KEY (target_copy)
+               REFERENCES booking.resource(id)
+               ON DELETE CASCADE
+               DEFERRABLE INITIALLY DEFERRED,
+       ADD CONSTRAINT reservation_transit_copy_reservation_fkey FOREIGN KEY (reservation)
+               REFERENCES booking.reservation(id)
+               ON DELETE SET NULL
+               DEFERRABLE INITIALLY DEFERRED;
+
 COMMIT;
 
 -- Some operations go outside of the transaction, because they may