Upgrade script issue with table changes for config.hold_matrix_matchpoint. user/bshum/2.0-2.1-hold_matrix_fix
authorBen Shum <bshum@biblio.org>
Sat, 20 Aug 2011 11:10:26 +0000 (07:10 -0400)
committerBen Shum <bshum@biblio.org>
Sat, 20 Aug 2011 11:10:26 +0000 (07:10 -0400)
Consolidated table changes into a single block similar to how
config.circ_matrix_matchpoint was done.

Signed-off-by: Ben Shum <bshum@biblio.org>
Open-ILS/src/sql/Pg/2.0-2.1-upgrade-db.sql

index e436bc6..3c5cf64 100644 (file)
@@ -10,8 +10,15 @@ BEGIN;
 ALTER TABLE permission.grp_tree
         ADD COLUMN hold_priority INT NOT NULL DEFAULT 0;
 
--- 0430
-ALTER TABLE config.hold_matrix_matchpoint ADD COLUMN strict_ou_match BOOL NOT NULL DEFAULT FALSE;
+-- 0430, and parts of others
+-- Hold matchpoint table changes combined
+ALTER TABLE config.hold_matrix_matchpoint
+    ADD COLUMN strict_ou_match BOOL NOT NULL DEFAULT FALSE,
+    ADD COLUMN marc_bib_level text,
+    DROP CONSTRAINT hous_once_per_grp_loc_mod_marc,
+    DROP CONSTRAINT hold_matrix_matchpoint_marc_form_fkey,
+    DROP CONSTRAINT hold_matrix_matchpoint_marc_type_fkey,
+    DROP CONSTRAINT hold_matrix_matchpoint_marc_vr_format_fkey;
 
 -- Replace all uses of PostgreSQL's built-in LOWER() function with
 -- a more locale-savvy PLPERLU evergreen.lowercase() function
@@ -644,9 +651,6 @@ ALTER TABLE config.circ_matrix_matchpoint
     DROP CONSTRAINT circ_matrix_matchpoint_marc_type_fkey,
     DROP CONSTRAINT circ_matrix_matchpoint_marc_vr_format_fkey;
 
-ALTER TABLE config.hold_matrix_matchpoint
-    DROP CONSTRAINT hous_once_per_grp_loc_mod_marc;
-
 -- Clean up tables before making normalized index
 
 CREATE OR REPLACE FUNCTION action.cleanup_matrix_matchpoints() RETURNS void AS $func$
@@ -1420,10 +1424,6 @@ INSERT INTO config.coded_value_map (ctype,code,value,description)
 
 ALTER TABLE config.i18n_locale DROP CONSTRAINT i18n_locale_marc_code_fkey;
 
-ALTER TABLE config.hold_matrix_matchpoint DROP CONSTRAINT hold_matrix_matchpoint_marc_form_fkey;
-ALTER TABLE config.hold_matrix_matchpoint DROP CONSTRAINT hold_matrix_matchpoint_marc_type_fkey;
-ALTER TABLE config.hold_matrix_matchpoint DROP CONSTRAINT hold_matrix_matchpoint_marc_vr_format_fkey;
-
 DROP TABLE config.language_map;
 DROP TABLE config.bib_level_map;
 DROP TABLE config.item_form_map;
@@ -4920,8 +4920,6 @@ ALTER TABLE config.circ_matrix_weights ALTER COLUMN marc_bib_level DROP DEFAULT;
 
 ALTER TABLE config.hold_matrix_weights ALTER COLUMN marc_bib_level DROP DEFAULT;
 
-ALTER TABLE config.hold_matrix_matchpoint ADD COLUMN marc_bib_level text;
-
 CREATE OR REPLACE FUNCTION action.find_circ_matrix_matchpoint( context_ou INT, item_object asset.copy, user_object actor.usr, renewal BOOL ) RETURNS action.found_circ_matrix_matchpoint AS $func$
 DECLARE
     cn_object       asset.call_number%ROWTYPE;