LP#1426133: Stamping upgrade script for set merge_profile_id_seq
authorBen Shum <bshum@biblio.org>
Fri, 27 Feb 2015 15:25:48 +0000 (10:25 -0500)
committerBen Shum <bshum@biblio.org>
Fri, 27 Feb 2015 15:25:48 +0000 (10:25 -0500)
Signed-off-by: Ben Shum <bshum@biblio.org>
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/upgrade/0913.schema.redo_vandelay_merge_profile_sequence.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.redo_vandelay_merge_profile_sequence.sql [deleted file]

index 7e49b70..97288b3 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');
 
     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 ('0912', :eg_version); -- jboyer/mmorgan/kmlussier/bshum
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0913', :eg_version); -- remington/bshum
 
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
 
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/0913.schema.redo_vandelay_merge_profile_sequence.sql b/Open-ILS/src/sql/Pg/upgrade/0913.schema.redo_vandelay_merge_profile_sequence.sql
new file mode 100644 (file)
index 0000000..a8b437a
--- /dev/null
@@ -0,0 +1,24 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('0913', :eg_version);
+
+--stock evergreen comes with 2 merge profiles; move any custom profiles
+UPDATE vandelay.merge_profile SET id = id + 100 WHERE id > 2;
+
+--update the same ids in org unit settings, stored in double quotes
+UPDATE actor.org_unit_setting
+    SET value = '"' || merge_profile_id+100 || '"'
+       FROM (
+               SELECT id, (regexp_matches(value, '"(\d+)"'))[1]::int as merge_profile_id FROM actor.org_unit_setting
+               WHERE name IN (
+                       'acq.upload.default.vandelay.low_quality_fall_thru_profile',
+                       'acq.upload.default.vandelay.merge_profile'
+               )
+       ) as foo
+       WHERE actor.org_unit_setting.id = foo.id
+       AND foo.merge_profile_id > 2;
+
+--set sequence's next value to 100, or more if necessary
+SELECT SETVAL('vandelay.merge_profile_id_seq', GREATEST(100, (SELECT MAX(id) FROM vandelay.merge_profile)));
+
+COMMIT;
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.redo_vandelay_merge_profile_sequence.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.redo_vandelay_merge_profile_sequence.sql
deleted file mode 100644 (file)
index bf0f5c9..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-BEGIN;
-
---SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
-
---stock evergreen comes with 2 merge profiles; move any custom profiles
-UPDATE vandelay.merge_profile SET id = id + 100 WHERE id > 2;
-
---update the same ids in org unit settings, stored in double quotes
-UPDATE actor.org_unit_setting
-    SET value = '"' || merge_profile_id+100 || '"'
-       FROM (
-               SELECT id, (regexp_matches(value, '"(\d+)"'))[1]::int as merge_profile_id FROM actor.org_unit_setting
-               WHERE name IN (
-                       'acq.upload.default.vandelay.low_quality_fall_thru_profile',
-                       'acq.upload.default.vandelay.merge_profile'
-               )
-       ) as foo
-       WHERE actor.org_unit_setting.id = foo.id
-       AND foo.merge_profile_id > 2;
-
---set sequence's next value to 100, or more if necessary
-SELECT SETVAL('vandelay.merge_profile_id_seq', GREATEST(100, (SELECT MAX(id) FROM vandelay.merge_profile)));
-
-COMMIT;