LP#1442254: Stamping upgrade script for use-ws-lib-for-messages
authorBen Shum <bshum@biblio.org>
Fri, 10 Apr 2015 01:58:07 +0000 (21:58 -0400)
committerBen Shum <bshum@biblio.org>
Fri, 10 Apr 2015 01:58:07 +0000 (21:58 -0400)
Signed-off-by: Ben Shum <bshum@biblio.org>
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/upgrade/0916.schema.use-ws-lib-for-messages.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/upgrade/ZZZZ.schema.use-ws-lib-for-messages.sql [deleted file]

index 2d5f0f5..751ad16 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 ('0915', :eg_version); -- berick
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0916', :eg_version); -- gmcharlt/kmlussier/bshum
 
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/0916.schema.use-ws-lib-for-messages.sql b/Open-ILS/src/sql/Pg/upgrade/0916.schema.use-ws-lib-for-messages.sql
new file mode 100644 (file)
index 0000000..3cccc34
--- /dev/null
@@ -0,0 +1,32 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('0916', :eg_version);
+
+CREATE OR REPLACE FUNCTION actor.convert_usr_note_to_message () RETURNS TRIGGER AS $$
+DECLARE
+       sending_ou INTEGER;
+BEGIN
+       IF NEW.pub THEN
+               IF TG_OP = 'UPDATE' THEN
+                       IF OLD.pub = TRUE THEN
+                               RETURN NEW;
+                       END IF;
+               END IF;
+
+               SELECT INTO sending_ou aw.owning_lib
+               FROM auditor.get_audit_info() agai
+               JOIN actor.workstation aw ON (aw.id = agai.eg_ws);
+               IF sending_ou IS NULL THEN
+                       SELECT INTO sending_ou home_ou
+                       FROM actor.usr
+                       WHERE id = NEW.creator;
+               END IF;
+               INSERT INTO actor.usr_message (usr, title, message, sending_lib)
+                       VALUES (NEW.usr, NEW.title, NEW.value, sending_ou);
+       END IF;
+
+       RETURN NEW;
+END;
+$$ LANGUAGE PLPGSQL;
+
+COMMIT;
diff --git a/Open-ILS/src/sql/Pg/upgrade/ZZZZ.schema.use-ws-lib-for-messages.sql b/Open-ILS/src/sql/Pg/upgrade/ZZZZ.schema.use-ws-lib-for-messages.sql
deleted file mode 100644 (file)
index 0163d0b..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-BEGIN;
-
-CREATE OR REPLACE FUNCTION actor.convert_usr_note_to_message () RETURNS TRIGGER AS $$
-DECLARE
-       sending_ou INTEGER;
-BEGIN
-       IF NEW.pub THEN
-               IF TG_OP = 'UPDATE' THEN
-                       IF OLD.pub = TRUE THEN
-                               RETURN NEW;
-                       END IF;
-               END IF;
-
-               SELECT INTO sending_ou aw.owning_lib
-               FROM auditor.get_audit_info() agai
-               JOIN actor.workstation aw ON (aw.id = agai.eg_ws);
-               IF sending_ou IS NULL THEN
-                       SELECT INTO sending_ou home_ou
-                       FROM actor.usr
-                       WHERE id = NEW.creator;
-               END IF;
-               INSERT INTO actor.usr_message (usr, title, message, sending_lib)
-                       VALUES (NEW.usr, NEW.title, NEW.value, sending_ou);
-       END IF;
-
-       RETURN NEW;
-END;
-$$ LANGUAGE PLPGSQL;
-
-COMMIT;