LP#1506534: Stamping upgrade script for new z3950_attr_type check
authorBen Shum <ben@evergreener.net>
Sun, 28 Feb 2016 00:27:45 +0000 (19:27 -0500)
committerBen Shum <ben@evergreener.net>
Sun, 28 Feb 2016 00:30:51 +0000 (19:30 -0500)
Signed-off-by: Ben Shum <ben@evergreener.net>
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/upgrade/0963.schema.config_z3950_attr_check.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.config_z3950_attr_check.sql [deleted file]

index 009db22..edb2de6 100644 (file)
@@ -91,7 +91,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 ('0962', :eg_version); -- dbwells/kmlussier
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0963', :eg_version); -- jboyer/bshum
 
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/0963.schema.config_z3950_attr_check.sql b/Open-ILS/src/sql/Pg/upgrade/0963.schema.config_z3950_attr_check.sql
new file mode 100644 (file)
index 0000000..0890974
--- /dev/null
@@ -0,0 +1,33 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('0963', :eg_version);
+
+ALTER TABLE config.z3950_index_field_map DROP CONSTRAINT "valid_z3950_attr_type";
+
+DROP FUNCTION evergreen.z3950_attr_name_is_valid(text);
+
+CREATE OR REPLACE FUNCTION evergreen.z3950_attr_name_is_valid() RETURNS TRIGGER AS $func$
+BEGIN
+
+  PERFORM * FROM config.z3950_attr WHERE name = NEW.z3950_attr_type;
+
+  IF FOUND THEN
+    RETURN NULL;
+  END IF;
+
+  RAISE EXCEPTION '% is not a valid Z39.50 attribute type', NEW.z3950_attr_type;
+
+END;
+$func$ LANGUAGE PLPGSQL STABLE;
+
+COMMENT ON FUNCTION evergreen.z3950_attr_name_is_valid() IS $$
+Used by a config.z3950_index_field_map constraint trigger
+to verify z3950_attr_type maps.
+$$;
+
+CREATE CONSTRAINT TRIGGER valid_z3950_attr_type AFTER INSERT OR UPDATE ON config.z3950_index_field_map
+  DEFERRABLE INITIALLY DEFERRED FOR EACH ROW WHEN (NEW.z3950_attr_type IS NOT NULL)
+  EXECUTE PROCEDURE evergreen.z3950_attr_name_is_valid();
+
+COMMIT;
+
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.config_z3950_attr_check.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.config_z3950_attr_check.sql
deleted file mode 100644 (file)
index 8267292..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-BEGIN;
-
-SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
-
-ALTER TABLE config.z3950_index_field_map DROP CONSTRAINT "valid_z3950_attr_type";
-
-DROP FUNCTION evergreen.z3950_attr_name_is_valid(text);
-
-CREATE OR REPLACE FUNCTION evergreen.z3950_attr_name_is_valid() RETURNS TRIGGER AS $func$
-BEGIN
-
-  PERFORM * FROM config.z3950_attr WHERE name = NEW.z3950_attr_type;
-
-  IF FOUND THEN
-    RETURN NULL;
-  END IF;
-
-  RAISE EXCEPTION '% is not a valid Z39.50 attribute type', NEW.z3950_attr_type;
-
-END;
-$func$ LANGUAGE PLPGSQL STABLE;
-
-COMMENT ON FUNCTION evergreen.z3950_attr_name_is_valid() IS $$
-Used by a config.z3950_index_field_map constraint trigger
-to verify z3950_attr_type maps.
-$$;
-
-CREATE CONSTRAINT TRIGGER valid_z3950_attr_type AFTER INSERT OR UPDATE ON config.z3950_index_field_map
-  DEFERRABLE INITIALLY DEFERRED FOR EACH ROW WHEN (NEW.z3950_attr_type IS NOT NULL)
-  EXECUTE PROCEDURE evergreen.z3950_attr_name_is_valid();
-
-COMMIT;
-