LP#1777675 Stamping upgrade script for latest inventory date support
authorDan Wells <dbw2@calvin.edu>
Tue, 4 Sep 2018 20:36:09 +0000 (16:36 -0400)
committerDan Wells <dbw2@calvin.edu>
Tue, 4 Sep 2018 20:38:22 +0000 (16:38 -0400)
Signed-off-by: Dan Wells <dbw2@calvin.edu>
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/upgrade/1125.schema.lp1777675_latest_inventory_date_support.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/upgrade/XXXX-create-inventory-workstation-and-date.sql [deleted file]

index 5fb343d..c6aab8e 100644 (file)
@@ -92,7 +92,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 ('1124', :eg_version); -- miker/kmlussier/berick
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1125', :eg_version); -- khuckins/kmlussier/dbwells
 
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/1125.schema.lp1777675_latest_inventory_date_support.sql b/Open-ILS/src/sql/Pg/upgrade/1125.schema.lp1777675_latest_inventory_date_support.sql
new file mode 100644 (file)
index 0000000..aba4590
--- /dev/null
@@ -0,0 +1,39 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('1125', :eg_version);
+
+CREATE TABLE asset.latest_inventory (
+    id                          SERIAL                      PRIMARY KEY,
+    inventory_workstation       INTEGER                     REFERENCES actor.workstation (id) DEFERRABLE INITIALLY DEFERRED,
+    inventory_date              TIMESTAMP WITH TIME ZONE    DEFAULT NOW(),
+    copy                        BIGINT                      NOT NULL
+);
+CREATE INDEX latest_inventory_copy_idx ON asset.latest_inventory (copy);
+
+CREATE OR REPLACE FUNCTION evergreen.asset_latest_inventory_copy_inh_fkey() RETURNS TRIGGER AS $f$
+BEGIN
+        PERFORM 1 FROM asset.copy WHERE id = NEW.copy;
+        IF NOT FOUND THEN
+                RAISE foreign_key_violation USING MESSAGE = FORMAT(
+                        $$Referenced asset.copy id not found, copy:%s$$, NEW.copy
+                );
+        END IF;
+        RETURN NEW;
+END;
+$f$ LANGUAGE PLPGSQL VOLATILE COST 50;
+
+CREATE CONSTRAINT TRIGGER inherit_asset_latest_inventory_copy_fkey
+        AFTER UPDATE OR INSERT ON asset.latest_inventory
+        DEFERRABLE FOR EACH ROW EXECUTE PROCEDURE evergreen.asset_latest_inventory_copy_inh_fkey();
+
+INSERT into config.workstation_setting_type (name, grp, datatype, label)
+VALUES (
+    'eg.circ.checkin.do_inventory_update', 'circ', 'bool',
+    oils_i18n_gettext (
+             'eg.circ.checkin.do_inventory_update',
+             'Checkin: Update Inventory',
+             'cwst', 'label'
+    )
+);
+
+COMMIT;
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX-create-inventory-workstation-and-date.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX-create-inventory-workstation-and-date.sql
deleted file mode 100644 (file)
index 8c6cea2..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-BEGIN;
-
-SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
-
-CREATE TABLE asset.latest_inventory (
-    id                          SERIAL                      PRIMARY KEY,
-    inventory_workstation       INTEGER                     REFERENCES actor.workstation (id) DEFERRABLE INITIALLY DEFERRED,
-    inventory_date              TIMESTAMP WITH TIME ZONE    DEFAULT NOW(),
-    copy                        BIGINT                      NOT NULL
-);
-CREATE INDEX latest_inventory_copy_idx ON asset.latest_inventory (copy);
-
-CREATE OR REPLACE FUNCTION evergreen.asset_latest_inventory_copy_inh_fkey() RETURNS TRIGGER AS $f$
-BEGIN
-        PERFORM 1 FROM asset.copy WHERE id = NEW.copy;
-        IF NOT FOUND THEN
-                RAISE foreign_key_violation USING MESSAGE = FORMAT(
-                        $$Referenced asset.copy id not found, copy:%s$$, NEW.copy
-                );
-        END IF;
-        RETURN NEW;
-END;
-$f$ LANGUAGE PLPGSQL VOLATILE COST 50;
-
-CREATE CONSTRAINT TRIGGER inherit_asset_latest_inventory_copy_fkey
-        AFTER UPDATE OR INSERT ON asset.latest_inventory
-        DEFERRABLE FOR EACH ROW EXECUTE PROCEDURE evergreen.asset_latest_inventory_copy_inh_fkey();
-
-INSERT into config.workstation_setting_type (name, grp, datatype, label)
-VALUES (
-    'eg.circ.checkin.do_inventory_update', 'circ', 'bool',
-    oils_i18n_gettext (
-             'eg.circ.checkin.do_inventory_update',
-             'Checkin: Update Inventory',
-             'cwst', 'label'
-    )
-);
-
-COMMIT;