From: Mike Rylander Date: Tue, 9 Aug 2011 17:26:17 +0000 (-0400) Subject: Stamped upgrade scripts for LP#797409 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=429384ac1f7a7904bb23dabe52586db66b30611c;p=evergreen%2Fjoelewis.git Stamped upgrade scripts for LP#797409 Signed-off-by: Mike Rylander --- diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 950947e05a..a8c2e9fff3 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -86,7 +86,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 ('0592', :eg_version); -- mrperters-isl/miker +INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0594', :eg_version); -- phasefx/miker CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, diff --git a/Open-ILS/src/sql/Pg/upgrade/0593.data.org-setting-circ.offline.skip_foo_if_newer_status_changed_time.sql b/Open-ILS/src/sql/Pg/upgrade/0593.data.org-setting-circ.offline.skip_foo_if_newer_status_changed_time.sql new file mode 100644 index 0000000000..d8a121d6c7 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0593.data.org-setting-circ.offline.skip_foo_if_newer_status_changed_time.sql @@ -0,0 +1,69 @@ +-- Evergreen DB patch XXXX.data.org-setting-circ.offline.skip_foo_if_newer_status_changed_time.sql +-- +-- New org setting circ.offline.skip_checkout_if_newer_status_changed_time +-- New org setting circ.offline.skip_renew_if_newer_status_changed_time +-- New org setting circ.offline.skip_checkin_if_newer_status_changed_time +-- +BEGIN; + +-- check whether patch can be applied +SELECT evergreen.upgrade_deps_block_check('0593', :eg_version); + +INSERT INTO config.org_unit_setting_type ( name, label, description, datatype ) + VALUES ( + 'circ.offline.skip_checkout_if_newer_status_changed_time', + oils_i18n_gettext( + 'circ.offline.skip_checkout_if_newer_status_changed_time', + 'Offline: Skip offline checkout if newer item Status Changed Time.', + 'coust', + 'label' + ), + oils_i18n_gettext( + 'circ.offline.skip_checkout_if_newer_status_changed_time', + 'Skip offline checkout transaction (raise exception when' + || ' processing) if item Status Changed Time is newer than the' + || ' recorded transaction time. WARNING: The Reshelving to' + || ' Available status rollover will trigger this.', + 'coust', + 'description' + ), + 'bool' + ),( + 'circ.offline.skip_renew_if_newer_status_changed_time', + oils_i18n_gettext( + 'circ.offline.skip_renew_if_newer_status_changed_time', + 'Offline: Skip offline renewal if newer item Status Changed Time.', + 'coust', + 'label' + ), + oils_i18n_gettext( + 'circ.offline.skip_renew_if_newer_status_changed_time', + 'Skip offline renewal transaction (raise exception when' + || ' processing) if item Status Changed Time is newer than the' + || ' recorded transaction time. WARNING: The Reshelving to' + || ' Available status rollover will trigger this.', + 'coust', + 'description' + ), + 'bool' + ),( + 'circ.offline.skip_checkin_if_newer_status_changed_time', + oils_i18n_gettext( + 'circ.offline.skip_checkin_if_newer_status_changed_time', + 'Offline: Skip offline checkin if newer item Status Changed Time.', + 'coust', + 'label' + ), + oils_i18n_gettext( + 'circ.offline.skip_checkin_if_newer_status_changed_time', + 'Skip offline checkin transaction (raise exception when' + || ' processing) if item Status Changed Time is newer than the' + || ' recorded transaction time. WARNING: The Reshelving to' + || ' Available status rollover will trigger this.', + 'coust', + 'description' + ), + 'bool' + ); + +COMMIT; diff --git a/Open-ILS/src/sql/Pg/upgrade/0594.schema.acp_status_date_changed.sql b/Open-ILS/src/sql/Pg/upgrade/0594.schema.acp_status_date_changed.sql new file mode 100644 index 0000000000..c55abd8d43 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0594.schema.acp_status_date_changed.sql @@ -0,0 +1,29 @@ +-- Evergreen DB patch YYYY.schema.acp_status_date_changed.sql +-- +-- Change trigger which updates copy status_changed_time to ignore the +-- Reshelving->Available status rollover +-BEGIN; + +-- FIXME: 0039.schema.acp_status_date_changed.sql defines this the first time +-- around, but along with the column itself, etc. And it gets modified with +-- 0562.schema.copy_active_date.sql. Not sure how to use the supercedes / +-- deprecate stuff for upgrade scripts, if it's even applicable when a given +-- upgrade script is doing so much. + +-- check whether patch can be applied +SELECT evergreen.upgrade_deps_block_check('0594', :eg_version); + +CREATE OR REPLACE FUNCTION asset.acp_status_changed() +RETURNS TRIGGER AS $$ +BEGIN + IF NEW.status <> OLD.status AND NOT (NEW.status = 0 AND OLD.status = 7) THEN + NEW.status_changed_time := now(); + IF NEW.active_date IS NULL AND NEW.status IN (SELECT id FROM config.copy_status WHERE copy_active = true) THEN + NEW.active_date := now(); + END IF; + END IF; + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +COMMIT; diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.org-setting-circ.offline.skip_foo_if_newer_status_changed_time.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.org-setting-circ.offline.skip_foo_if_newer_status_changed_time.sql deleted file mode 100644 index 0a68459842..0000000000 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.org-setting-circ.offline.skip_foo_if_newer_status_changed_time.sql +++ /dev/null @@ -1,69 +0,0 @@ --- Evergreen DB patch XXXX.data.org-setting-circ.offline.skip_foo_if_newer_status_changed_time.sql --- --- New org setting circ.offline.skip_checkout_if_newer_status_changed_time --- New org setting circ.offline.skip_renew_if_newer_status_changed_time --- New org setting circ.offline.skip_checkin_if_newer_status_changed_time --- -BEGIN; - --- check whether patch can be applied -SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version); - -INSERT INTO config.org_unit_setting_type ( name, label, description, datatype ) - VALUES ( - 'circ.offline.skip_checkout_if_newer_status_changed_time', - oils_i18n_gettext( - 'circ.offline.skip_checkout_if_newer_status_changed_time', - 'Offline: Skip offline checkout if newer item Status Changed Time.', - 'coust', - 'label' - ), - oils_i18n_gettext( - 'circ.offline.skip_checkout_if_newer_status_changed_time', - 'Skip offline checkout transaction (raise exception when' - || ' processing) if item Status Changed Time is newer than the' - || ' recorded transaction time. WARNING: The Reshelving to' - || ' Available status rollover will trigger this.', - 'coust', - 'description' - ), - 'bool' - ),( - 'circ.offline.skip_renew_if_newer_status_changed_time', - oils_i18n_gettext( - 'circ.offline.skip_renew_if_newer_status_changed_time', - 'Offline: Skip offline renewal if newer item Status Changed Time.', - 'coust', - 'label' - ), - oils_i18n_gettext( - 'circ.offline.skip_renew_if_newer_status_changed_time', - 'Skip offline renewal transaction (raise exception when' - || ' processing) if item Status Changed Time is newer than the' - || ' recorded transaction time. WARNING: The Reshelving to' - || ' Available status rollover will trigger this.', - 'coust', - 'description' - ), - 'bool' - ),( - 'circ.offline.skip_checkin_if_newer_status_changed_time', - oils_i18n_gettext( - 'circ.offline.skip_checkin_if_newer_status_changed_time', - 'Offline: Skip offline checkin if newer item Status Changed Time.', - 'coust', - 'label' - ), - oils_i18n_gettext( - 'circ.offline.skip_checkin_if_newer_status_changed_time', - 'Skip offline checkin transaction (raise exception when' - || ' processing) if item Status Changed Time is newer than the' - || ' recorded transaction time. WARNING: The Reshelving to' - || ' Available status rollover will trigger this.', - 'coust', - 'description' - ), - 'bool' - ); - -COMMIT; diff --git a/Open-ILS/src/sql/Pg/upgrade/YYYY.schema.acp_status_date_changed.sql b/Open-ILS/src/sql/Pg/upgrade/YYYY.schema.acp_status_date_changed.sql deleted file mode 100644 index 34715d1011..0000000000 --- a/Open-ILS/src/sql/Pg/upgrade/YYYY.schema.acp_status_date_changed.sql +++ /dev/null @@ -1,29 +0,0 @@ --- Evergreen DB patch YYYY.schema.acp_status_date_changed.sql --- --- Change trigger which updates copy status_changed_time to ignore the --- Reshelving->Available status rollover --BEGIN; - --- FIXME: 0039.schema.acp_status_date_changed.sql defines this the first time --- around, but along with the column itself, etc. And it gets modified with --- 0562.schema.copy_active_date.sql. Not sure how to use the supercedes / --- deprecate stuff for upgrade scripts, if it's even applicable when a given --- upgrade script is doing so much. - --- check whether patch can be applied -SELECT evergreen.upgrade_deps_block_check('YYYY', :eg_version); - -CREATE OR REPLACE FUNCTION asset.acp_status_changed() -RETURNS TRIGGER AS $$ -BEGIN - IF NEW.status <> OLD.status AND NOT (NEW.status = 0 AND OLD.status = 7) THEN - NEW.status_changed_time := now(); - IF NEW.active_date IS NULL AND NEW.status IN (SELECT id FROM config.copy_status WHERE copy_active = true) THEN - NEW.active_date := now(); - END IF; - END IF; - RETURN NEW; -END; -$$ LANGUAGE plpgsql; - -COMMIT;