[open-ils-commits] [GIT] Evergreen ILS branch rel_2_3 updated. aab7d0c5f1c6a886825e1af533e660e8fe6bd29a
Evergreen Git
git at git.evergreen-ils.org
Wed Dec 19 15:09:06 EST 2012
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".
The branch, rel_2_3 has been updated
via aab7d0c5f1c6a886825e1af533e660e8fe6bd29a (commit)
from ffd0f422c2decaf9418a1ce290006e7c7f6d17bd (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit aab7d0c5f1c6a886825e1af533e660e8fe6bd29a
Author: Dan Wells <dbw2 at calvin.edu>
Date: Tue Dec 18 15:51:12 2012 -0500
Make config.update_coded_value_map() consistent
The version of this function in the upgrade file is different than
the one in the 002.schema.config.sql file. This commit fixes the
broken logic in the 002 file and makes it match the logic in the
old upgrade file.
Signed-off-by: Dan Wells <dbw2 at calvin.edu>
Signed-off-by: Dan Scott <dscott at laurentian.ca>
diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index d069cc0..196e37f 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -87,7 +87,7 @@ CREATE TRIGGER no_overlapping_deps
BEFORE INSERT OR UPDATE ON config.db_patch_dependencies
FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates');
-INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0746', :eg_version); -- mrpeters-isl/bshum
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0748', :eg_version); -- dbwells/dbs
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
@@ -762,7 +762,7 @@ BEGIN
-- Look for a current value
SELECT INTO current_row * FROM config.coded_value_map WHERE ctype = in_ctype AND code = in_code;
-- If we have one..
- IF FOUND THEN
+ IF FOUND AND NOT add_only THEN
-- Update anything we were handed
current_row.value := COALESCE(current_row.value, in_value);
current_row.description := COALESCE(current_row.description, in_description);
@@ -777,7 +777,7 @@ BEGIN
search_label = current_row.search_label,
is_simple = current_row.is_simple
WHERE id = current_row.id;
- ELSIF NOT add_only THEN
+ ELSE
INSERT INTO config.coded_value_map(ctype, code, value, description, opac_visible, search_label, is_simple) VALUES
(in_ctype, in_code, in_value, in_description, COALESCE(in_opac_visible, TRUE), in_search_label, COALESCE(in_is_simple, FALSE));
END IF;
diff --git a/Open-ILS/src/sql/Pg/upgrade/0748.function.update_coded_value_map.sql b/Open-ILS/src/sql/Pg/upgrade/0748.function.update_coded_value_map.sql
new file mode 100644
index 0000000..a5fe819
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/0748.function.update_coded_value_map.sql
@@ -0,0 +1,38 @@
+-- LP#1091831 - reapply config.update_coded_value_map()
+-- due to broken schema version
+--
+BEGIN;
+
+-- check whether patch can be applied
+SELECT evergreen.upgrade_deps_block_check('0748', :eg_version);
+
+CREATE OR REPLACE FUNCTION config.update_coded_value_map(in_ctype TEXT, in_code TEXT, in_value TEXT, in_description TEXT DEFAULT NULL, in_opac_visible BOOL DEFAULT NULL, in_search_label TEXT DEFAULT NULL, in_is_simple BOOL DEFAULT NULL, add_only BOOL DEFAULT FALSE) RETURNS VOID AS $f$
+DECLARE
+ current_row config.coded_value_map%ROWTYPE;
+BEGIN
+ -- Look for a current value
+ SELECT INTO current_row * FROM config.coded_value_map WHERE ctype = in_ctype AND code = in_code;
+ -- If we have one..
+ IF FOUND AND NOT add_only THEN
+ -- Update anything we were handed
+ current_row.value := COALESCE(current_row.value, in_value);
+ current_row.description := COALESCE(current_row.description, in_description);
+ current_row.opac_visible := COALESCE(current_row.opac_visible, in_opac_visible);
+ current_row.search_label := COALESCE(current_row.search_label, in_search_label);
+ current_row.is_simple := COALESCE(current_row.is_simple, in_is_simple);
+ UPDATE config.coded_value_map
+ SET
+ value = current_row.value,
+ description = current_row.description,
+ opac_visible = current_row.opac_visible,
+ search_label = current_row.search_label,
+ is_simple = current_row.is_simple
+ WHERE id = current_row.id;
+ ELSE
+ INSERT INTO config.coded_value_map(ctype, code, value, description, opac_visible, search_label, is_simple) VALUES
+ (in_ctype, in_code, in_value, in_description, COALESCE(in_opac_visible, TRUE), in_search_label, COALESCE(in_is_simple, FALSE));
+ END IF;
+END;
+$f$ LANGUAGE PLPGSQL;
+
+COMMIT;
-----------------------------------------------------------------------
Summary of changes:
Open-ILS/src/sql/Pg/002.schema.config.sql | 6 ++--
.../0748.function.update_coded_value_map.sql | 38 ++++++++++++++++++++
2 files changed, 41 insertions(+), 3 deletions(-)
create mode 100644 Open-ILS/src/sql/Pg/upgrade/0748.function.update_coded_value_map.sql
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list