From: Jason Stephenson Date: Wed, 16 Mar 2016 20:54:44 +0000 (-0400) Subject: Forward port 2.9.2 to 2.9.3 upgrade script and server upgrade instructions. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=4c0b69dd7e170577b62b60f5b12d06b8a97f4585;p=Evergreen.git Forward port 2.9.2 to 2.9.3 upgrade script and server upgrade instructions. Signed-off-by: Jason Stephenson --- diff --git a/Open-ILS/src/sql/Pg/version-upgrade/2.9.2-2.9.3-upgrade-db.sql b/Open-ILS/src/sql/Pg/version-upgrade/2.9.2-2.9.3-upgrade-db.sql new file mode 100644 index 0000000000..fd9926653d --- /dev/null +++ b/Open-ILS/src/sql/Pg/version-upgrade/2.9.2-2.9.3-upgrade-db.sql @@ -0,0 +1,180 @@ +--Upgrade Script for 2.9.2 to 2.9.3 +\set eg_version '''2.9.3''' +BEGIN; +INSERT INTO config.upgrade_log (version, applied_to) VALUES ('2.9.3', :eg_version); + +SELECT evergreen.upgrade_deps_block_check('0959', :eg_version); + +CREATE OR REPLACE VIEW money.transaction_billing_summary AS + SELECT id as xact, + last_billing_type, + last_billing_note, + last_billing_ts, + total_owed + FROM money.materialized_billable_xact_summary; + + +SELECT evergreen.upgrade_deps_block_check('0971', :eg_version); + +CREATE OR REPLACE FUNCTION evergreen.protect_reserved_rows_from_delete() RETURNS trigger AS $protect_reserved$ +BEGIN +IF OLD.id < TG_ARGV[0]::INT THEN + RAISE EXCEPTION 'Cannot delete row with reserved ID %', OLD.id; +END IF; +RETURN OLD; +END +$protect_reserved$ +LANGUAGE plpgsql; + + +SELECT evergreen.upgrade_deps_block_check('0972', :eg_version); -- jstompro/gmcharlt + +-- LP#1550495 - Add Baker&Taylor EDI Quantity Cancel Code +-- Insert EDI Cancel Reason 85 (1200 + 85 = 1285) if it doesn't already exist +INSERT INTO acq.cancel_reason + (org_unit, keep_debits, id, label, description) + SELECT + 1, 'f',( 85+1200), + oils_i18n_gettext(1285, 'Canceled: By Vendor', 'acqcr', 'label'), + oils_i18n_gettext(1285, 'Line item canceled by vendor', 'acqcr', 'description') + WHERE NOT EXISTS ( + SELECT 1 FROM acq.cancel_reason where id=(85+1200) + ); + + + +SELECT evergreen.upgrade_deps_block_check('0973', :eg_version); -- tmccanna/gmcharlt + +UPDATE action_trigger.event_definition SET template = +$$ +[%- USE date -%] +[%- SET user = target -%] +
+ +
[% date.format %]
+
+ Fines for:
+ [% user.family_name %], [% user.first_given_name %] +
    + [% FOR xact IN user.open_billable_transactions_summary %] + [% IF xact.balance_owed > 0 %] +
  1. +
    Details: + [% IF xact.xact_type == 'circulation' %] + [%- helpers.get_copy_bib_basics(xact.circulation.target_copy).title -%] + [% ELSE %] + [%- xact.last_billing_type -%] + [% END %] +
    +
    Total Billed: [% xact.total_owed %]
    +
    Total Paid: [% xact.total_paid %]
    +
    Balance Owed : [% xact.balance_owed %]
    +
  2. + [% END %] + [% END %] +
+
+$$ WHERE id=13 +AND template = +$$ +[%- USE date -%] +[%- SET user = target -%] +
+ +
[% date.format %]
+
+ + [% user.family_name %], [% user.first_given_name %] +
    + [% FOR xact IN user.open_billable_transactions_summary %] +
  1. +
    Details: + [% IF xact.xact_type == 'circulation' %] + [%- helpers.get_copy_bib_basics(xact.circulation.target_copy).title -%] + [% ELSE %] + [%- xact.last_billing_type -%] + [% END %] +
    +
    Total Billed: [% xact.total_owed %]
    +
    Total Paid: [% xact.total_paid %]
    +
    Balance Owed : [% xact.balance_owed %]
    +
  2. + [% END %] +
+
+$$ +; + + +SELECT evergreen.upgrade_deps_block_check('0974', :eg_version); -- tmccanna/gmcharlt + +UPDATE action_trigger.event_definition SET template = +$$ +[%- USE date -%] +[%- SET user = target.0.usr -%] +
+ +
[% date.format %]
+
+ Holds for:
+ [% user.family_name %], [% user.first_given_name %] + +
    + [% FOR hold IN target %] + [%- + SET idx = loop.count - 1; + SET udata = user_data.$idx; + -%] +
  1. +
    Title: [% udata.item_title %]
    +
    Author: [% udata.item_author %]
    +
    Pickup Location: [% udata.pickup_lib %]
    +
    Status: + [%- IF udata.ready -%] + Ready for pickup + [% ELSE %] + #[% udata.queue_position %] of + [% udata.potential_copies %] copies. + [% END %] +
    +
  2. + [% END %] +
+
+ +$$ WHERE id=12 +AND template = +$$ +[%- USE date -%] +[%- SET user = target.0.usr -%] +
+ +
[% date.format %]
+
+ + [% user.family_name %], [% user.first_given_name %] +
    + [% FOR hold IN target %] + [%- + SET idx = loop.count - 1; + SET udata = user_data.$idx + -%] +
  1. +
    Title: [% hold.bib_rec.bib_record.simple_record.title %]
    +
    Author: [% hold.bib_rec.bib_record.simple_record.author %]
    +
    Pickup Location: [% hold.pickup_lib.name %]
    +
    Status: + [%- IF udata.ready -%] + Ready for pickup + [% ELSE %] + #[% udata.queue_position %] of [% udata.potential_copies %] copies. + [% END %] +
    +
  2. + [% END %] +
+
+$$ +; + +COMMIT; diff --git a/docs/installation/server_upgrade.txt b/docs/installation/server_upgrade.txt index abf9063d68..ca3c2e9d4b 100644 --- a/docs/installation/server_upgrade.txt +++ b/docs/installation/server_upgrade.txt @@ -48,8 +48,8 @@ the http://evergreen-ils.org/opensrf-downloads/[OpenSRF download page]. + [source, bash] ----------------------------------------------- -wget http://evergreen-ils.org/downloads/Evergreen-ILS-2.9.2.tar.gz -tar xzf Evergreen-ILS-2.9.2.tar.gz +wget http://evergreen-ils.org/downloads/Evergreen-ILS-2.9.3.tar.gz +tar xzf Evergreen-ILS-2.9.3.tar.gz ----------------------------------------------- + [NOTE] @@ -59,7 +59,7 @@ For the latest edition of Evergreen, check the http://evergreen-ils.org/egdownlo + [source, bash] --------------------------------------------- -cd /home/opensrf/Evergreen-ILS-2.9.2 +cd /home/opensrf/Evergreen-ILS-2.9.3 --------------------------------------------- + On the next command, replace `[distribution]` with one of these values for your @@ -85,7 +85,7 @@ make -f Open-ILS/src/extras/Makefile.install [distribution] + [source, bash] ------------------------------------------------------------ -cd /home/opensrf/Evergreen-ILS-2.9.2 +cd /home/opensrf/Evergreen-ILS-2.9.3 PATH=/openils/bin:$PATH ./configure --prefix=/openils --sysconfdir=/openils/conf make ------------------------------------------------------------ @@ -96,8 +96,8 @@ These instructions assume that you have also installed OpenSRF under /openils/. + [source, bash] ------------------------------------------------------------ -cd /home/opensrf/Evergreen-ILS-2.9.2 -make STAFF_CLIENT_STAMP_ID=rel_2_9_2 install +cd /home/opensrf/Evergreen-ILS-2.9.3 +make STAFF_CLIENT_STAMP_ID=rel_2_9_3 install ------------------------------------------------------------ + . As the *root* user, change all files to be owned by the opensrf user and group: @@ -113,7 +113,7 @@ chown -R opensrf:opensrf /openils ----------------------------------------------------------- cd /openils/var/web/xul/ rm server -ln -sf rel_2_9_2/server server +ln -sf rel_2_9_3/server server ---------------------------------------------------------- + . As the *opensrf* user, update opensrf_core.xml and opensrf.xml by copying the @@ -133,7 +133,7 @@ Copying these configuration files will remove any customizations you have made t + [source, bash] ------------------------------------------------------------------------- -cd /home/opensrf/Evergreen-ILS-2.9.2 +cd /home/opensrf/Evergreen-ILS-2.9.3 perl Open-ILS/src/support-scripts/eg_db_config --update-config --service all \ --create-offline --database evergreen --host localhost --user evergreen --password evergreen ------------------------------------------------------------------------- @@ -157,21 +157,21 @@ The diff command can be used to show the differences between the distribution ve + [source, bash] ---------------------------------------------------------- -cp /home/opensrf/Evergreen-ILS-2.9.2/Open-ILS/examples/apache/eg_startup /etc/apache2/eg_startup +cp /home/opensrf/Evergreen-ILS-2.9.3/Open-ILS/examples/apache/eg_startup /etc/apache2/eg_startup ---------------------------------------------------------- + .. Update /etc/apache2/eg_vhost.conf by copying the example from Open-ILS/examples/apache/eg_vhost.conf. + [source, bash] ---------------------------------------------------------- -cp /home/opensrf/Evergreen-ILS-2.9.2/Open-ILS/examples/apache/eg_vhost.conf /etc/apache2/eg_vhost.conf +cp /home/opensrf/Evergreen-ILS-2.9.3/Open-ILS/examples/apache/eg_vhost.conf /etc/apache2/eg_vhost.conf ---------------------------------------------------------- + .. Update /etc/apache2/sites-available/eg.conf by copying the example from Open-ILS/examples/apache/eg.conf. + [source, bash] ---------------------------------------------------------- -cp /home/opensrf/Evergreen-ILS-2.9.2/Open-ILS/examples/apache/eg.conf /etc/apache2/sites-available/eg.conf +cp /home/opensrf/Evergreen-ILS-2.9.3/Open-ILS/examples/apache/eg.conf /etc/apache2/sites-available/eg.conf ---------------------------------------------------------- Upgrade the Evergreen database schema @@ -194,7 +194,7 @@ anything goes wrong during the upgrade. ============= Evergreen provides incremental upgrade scripts that allow you to upgrade from one minor version to the next until you have the current version of -the schema. For example, if you want to upgrade from 2.5.1 to 2.9.2, you +the schema. For example, if you want to upgrade from 2.5.1 to 2.9.3, you would run the following upgrade scripts: - 2.5.1-2.5.2-upgrade-db.sql @@ -214,13 +214,14 @@ would run the following upgrade scripts: - 2.8.4-2.9.0-upgrade-db.sql (this is a major version upgrade) - 2.9.0-2.9.1-upgrade-db.sql - 2.9.1-2.9.2-upgrade-db.sql +- 2.9.2-2.9.3-upgrade-db.sql Note that you do *not* want to run additional 2.5 scripts to upgrade to the newest version of 2.5, since currently there is no automated way to upgrade from 2.5.4+ to 2.6. Only upgrade as far as necessary to reach the major version upgrade script (in this example, as far as 2.5.3). -To upgrade across multiple major versions (e.g. from 2.3.0 to 2.9.2), use +To upgrade across multiple major versions (e.g. from 2.3.0 to 2.9.3), use the same logic to utilize the provided major version upgrade scripts. For example: @@ -236,7 +237,7 @@ example: - 2.7.4-2.8.0-upgrade-db.sql - (run all incremental scripts from 2.8.0 to 2.8.4) - 2.8.4-2.9.0-upgrade-db.sql -- (run all incremental scripts from 2.9.0 to 2.9.2) +- (run all incremental scripts from 2.9.0 to 2.9.3) ============= [CAUTION] @@ -250,8 +251,8 @@ as a user with the ability to connect to the database server. [source, bash] ---------------------------------------------------------- -cd /home/opensrf/Evergreen-ILS-2.9.2/Open-ILS/src/sql/Pg -psql -U evergreen -h localhost -f version-upgrade/2.8.4-2.9.0-upgrade-db.sql evergreen +cd /home/opensrf/Evergreen-ILS-2.9.3/Open-ILS/src/sql/Pg +psql -U evergreen -h localhost -f version-upgrade/2.9.2-2.9.3-upgrade-db.sql evergreen ---------------------------------------------------------- [TIP]