Wrap upgrade script for "pretty-print XML" function
authorDan Scott <dscott@laurentian.ca>
Mon, 30 Jul 2012 14:25:31 +0000 (10:25 -0400)
committerDan Scott <dscott@laurentian.ca>
Mon, 30 Jul 2012 14:25:31 +0000 (10:25 -0400)
Signed-off-by: Dan Scott <dscott@laurentian.ca>
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/upgrade/0727.function.xml_pretty_print.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/upgrade/XXXX.function.xml_pretty_print.sql [deleted file]

index 64a1a6a..1c885e4 100644 (file)
@@ -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 ('0726', :eg_version); -- denials
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0727', :eg_version); -- denials/mrpeters
 
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/0727.function.xml_pretty_print.sql b/Open-ILS/src/sql/Pg/upgrade/0727.function.xml_pretty_print.sql
new file mode 100644 (file)
index 0000000..d009070
--- /dev/null
@@ -0,0 +1,32 @@
+-- Evergreen DB patch 0727.function.xml_pretty_print.sql
+--
+-- A simple pretty printer for XML.
+-- Particularly useful for debugging the biblio.record_entry.marc field.
+--
+BEGIN;
+
+-- check whether patch can be applied
+SELECT evergreen.upgrade_deps_block_check('0727', :eg_version);
+
+CREATE OR REPLACE FUNCTION evergreen.xml_pretty_print(input XML) 
+    RETURNS XML
+    LANGUAGE SQL AS
+$func$
+SELECT xslt_process($1::text,
+$$<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+    version="1.0">
+   <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
+   <xsl:strip-space elements="*"/>
+   <xsl:template match="@*|node()">
+     <xsl:copy>
+       <xsl:apply-templates select="@*|node()"/>
+     </xsl:copy>
+   </xsl:template>
+ </xsl:stylesheet>
+$$::text)::XML
+$func$;
+
+COMMENT ON FUNCTION evergreen.xml_pretty_print(input XML) IS
+'Simple pretty printer for XML, as written by Andrew Dunstan at http://goo.gl/zBHIk';
+
+COMMIT;
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.xml_pretty_print.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.function.xml_pretty_print.sql
deleted file mode 100644 (file)
index 0992821..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-CREATE OR REPLACE FUNCTION evergreen.xml_pretty_print(input XML) 
-    RETURNS XML
-    LANGUAGE SQL AS
-$func$
-SELECT xslt_process($1::text,
-$$<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
-    version="1.0">
-   <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
-   <xsl:strip-space elements="*"/>
-   <xsl:template match="@*|node()">
-     <xsl:copy>
-       <xsl:apply-templates select="@*|node()"/>
-     </xsl:copy>
-   </xsl:template>
- </xsl:stylesheet>
-$$::text)::XML
-$func$;
-
-COMMENT ON FUNCTION evergreen.xml_pretty_print(input XML) IS
-'Simple pretty printer for XML, as written by Andrew Dunstan at http://goo.gl/zBHIk';
-