[open-ils-commits] r14992 - in trunk/Open-ILS/src/sql/Pg: . upgrade (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Nov 20 16:56:26 EST 2009
Author: dbs
Date: 2009-11-20 16:56:20 -0500 (Fri, 20 Nov 2009)
New Revision: 14992
Added:
trunk/Open-ILS/src/sql/Pg/upgrade/0088.schema.reporter.simple_record_trigger.sql
Removed:
trunk/Open-ILS/src/sql/Pg/1.2.3-1.4-upgrade-db.sql
Modified:
trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
trunk/Open-ILS/src/sql/Pg/reporter-schema.sql
Log:
Add a safer version of the reporter.disable_materialized_simple_record_trigger () function for PostgreSQL 8.2 and up
Also, remove that vestigial 1.2.3-1.4 upgrade script. DIE ALREADY.
Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2009-11-20 19:15:10 UTC (rev 14991)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2009-11-20 21:56:20 UTC (rev 14992)
@@ -51,7 +51,7 @@
install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);
-INSERT INTO config.upgrade_log (version) VALUES ('0087'); -- atz
+INSERT INTO config.upgrade_log (version) VALUES ('0088'); -- dbs
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
Deleted: trunk/Open-ILS/src/sql/Pg/1.2.3-1.4-upgrade-db.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/1.2.3-1.4-upgrade-db.sql 2009-11-20 19:15:10 UTC (rev 14991)
+++ trunk/Open-ILS/src/sql/Pg/1.2.3-1.4-upgrade-db.sql 2009-11-20 21:56:20 UTC (rev 14992)
@@ -1,22 +0,0 @@
-/* Enable LIKE to use an index for database clusters with locales other than C or POSIX */
-CREATE INDEX authority_full_rec_value_tpo_index ON authority.full_rec (value text_pattern_ops);
-
-/* Upgrade to MODS32 for transforms */
-ALTER TABLE config.metabib_field
- ALTER COLUMN format SET DEFAULT 'mods32';
-UPDATE config.metabib_field
- SET format = 'mods32';
-
-/* Update index definitions to MODS32-compliant XPaths */
-UPDATE config.metabib_field
- SET xpath = $$//mods:mods/mods:name[@type='corporate']/mods:namePart[../mods:role/mods:roleTerm[text()='creator']]$$
- WHERE field_class = 'author' AND name = 'corporate';
-UPDATE config.metabib_field
- SET xpath = $$//mods:mods/mods:name[@type='personal']/mods:namePart[../mods:role/mods:roleTerm[text()='creator']]$$
- WHERE field_class = 'author' AND name = 'personal';
-UPDATE config.metabib_field
- SET xpath = $$//mods:mods/mods:name[@type='conference']/mods:namePart[../mods:role/mods:roleTerm[text()='creator']]$$
- WHERE field_class = 'author' AND name = 'conference';
-/* And they all want mods32: as their prefix */
-UPDATE config.metabib_field
- SET xpath = regexp_replace(xpath, 'mods:', 'mods32:', 'g');
Modified: trunk/Open-ILS/src/sql/Pg/reporter-schema.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/reporter-schema.sql 2009-11-20 19:15:10 UTC (rev 14991)
+++ trunk/Open-ILS/src/sql/Pg/reporter-schema.sql 2009-11-20 21:56:20 UTC (rev 14992)
@@ -244,7 +244,7 @@
CREATE OR REPLACE FUNCTION reporter.disable_materialized_simple_record_trigger () RETURNS VOID AS $$
- DROP TRIGGER zzz_update_materialized_simple_record_tgr ON metabib.real_full_rec;
+ DROP TRIGGER IF EXISTS zzz_update_materialized_simple_record_tgr ON metabib.real_full_rec;
$$ LANGUAGE SQL;
CREATE OR REPLACE FUNCTION reporter.enable_materialized_simple_record_trigger () RETURNS VOID AS $$
Added: trunk/Open-ILS/src/sql/Pg/upgrade/0088.schema.reporter.simple_record_trigger.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0088.schema.reporter.simple_record_trigger.sql (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0088.schema.reporter.simple_record_trigger.sql 2009-11-20 21:56:20 UTC (rev 14992)
@@ -0,0 +1,11 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0088'); -- dbs
+
+-- Take advantage of the "IF EXISTS" option that has existed since
+-- PostgreSQL 8.2 to avoid SQL errors
+CREATE OR REPLACE FUNCTION reporter.disable_materialized_simple_record_trigger () RETURNS VOID AS $$
+ DROP TRIGGER IF EXISTS zzz_update_materialized_simple_record_tgr ON metabib.real_full_rec;
+$$ LANGUAGE SQL;
+
+COMMIT;
More information about the open-ils-commits
mailing list