From: Jason Stephenson Date: Fri, 19 Feb 2016 17:00:24 +0000 (-0500) Subject: Forward port 2.9.1 to 2.9.2 upgrade script and server upgrade instructions. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=39e197a71e5fc2c1818e4cd94f27941f4645e9da;p=Evergreen.git Forward port 2.9.1 to 2.9.2 upgrade script and server upgrade instructions. Signed-off-by: Jason Stephenson --- diff --git a/Open-ILS/src/sql/Pg/version-upgrade/2.9.1-2.9.2-upgrade-db.sql b/Open-ILS/src/sql/Pg/version-upgrade/2.9.1-2.9.2-upgrade-db.sql new file mode 100644 index 0000000000..883187feee --- /dev/null +++ b/Open-ILS/src/sql/Pg/version-upgrade/2.9.1-2.9.2-upgrade-db.sql @@ -0,0 +1,35 @@ +--Upgrade Script for 2.9.1 to 2.9.2 +\set eg_version '''2.9.2''' +BEGIN; +INSERT INTO config.upgrade_log (version, applied_to) VALUES ('2.9.2', :eg_version); + +SELECT evergreen.upgrade_deps_block_check('0950', :eg_version); + +CREATE OR REPLACE FUNCTION money.materialized_summary_billing_del () RETURNS TRIGGER AS $$ +DECLARE + prev_billing money.billing%ROWTYPE; + old_billing money.billing%ROWTYPE; +BEGIN + SELECT * INTO prev_billing FROM money.billing WHERE xact = OLD.xact AND NOT voided ORDER BY billing_ts DESC LIMIT 1 OFFSET 1; + SELECT * INTO old_billing FROM money.billing WHERE xact = OLD.xact AND NOT voided ORDER BY billing_ts DESC LIMIT 1; + + IF OLD.id = old_billing.id THEN + UPDATE money.materialized_billable_xact_summary + SET last_billing_ts = prev_billing.billing_ts, + last_billing_note = prev_billing.note, + last_billing_type = prev_billing.billing_type + WHERE id = OLD.xact; + END IF; + + IF NOT OLD.voided THEN + UPDATE money.materialized_billable_xact_summary + SET total_owed = total_owed - OLD.amount, + balance_owed = balance_owed - OLD.amount + WHERE id = OLD.xact; + END IF; + + RETURN OLD; +END; +$$ LANGUAGE PLPGSQL; + +COMMIT; diff --git a/docs/installation/server_upgrade.txt b/docs/installation/server_upgrade.txt index 9ff2489d4f..abf9063d68 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.1.tar.gz -tar xzf Evergreen-ILS-2.9.1.tar.gz +wget http://evergreen-ils.org/downloads/Evergreen-ILS-2.9.2.tar.gz +tar xzf Evergreen-ILS-2.9.2.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.1 +cd /home/opensrf/Evergreen-ILS-2.9.2 --------------------------------------------- + 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.1 +cd /home/opensrf/Evergreen-ILS-2.9.2 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.1 -make STAFF_CLIENT_STAMP_ID=rel_2_9_1 install +cd /home/opensrf/Evergreen-ILS-2.9.2 +make STAFF_CLIENT_STAMP_ID=rel_2_9_2 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_1/server server +ln -sf rel_2_9_2/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.1 +cd /home/opensrf/Evergreen-ILS-2.9.2 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.1/Open-ILS/examples/apache/eg_startup /etc/apache2/eg_startup +cp /home/opensrf/Evergreen-ILS-2.9.2/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.1/Open-ILS/examples/apache/eg_vhost.conf /etc/apache2/eg_vhost.conf +cp /home/opensrf/Evergreen-ILS-2.9.2/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.1/Open-ILS/examples/apache/eg.conf /etc/apache2/sites-available/eg.conf +cp /home/opensrf/Evergreen-ILS-2.9.2/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.1, you +the schema. For example, if you want to upgrade from 2.5.1 to 2.9.2, you would run the following upgrade scripts: - 2.5.1-2.5.2-upgrade-db.sql @@ -213,13 +213,14 @@ would run the following upgrade scripts: - 2.8.3-2.8.4-upgrade-db.sql - 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 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.1), use +To upgrade across multiple major versions (e.g. from 2.3.0 to 2.9.2), use the same logic to utilize the provided major version upgrade scripts. For example: @@ -235,7 +236,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.1) +- (run all incremental scripts from 2.9.0 to 2.9.2) ============= [CAUTION] @@ -249,7 +250,7 @@ as a user with the ability to connect to the database server. [source, bash] ---------------------------------------------------------- -cd /home/opensrf/Evergreen-ILS-2.9.1/Open-ILS/src/sql/Pg +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 ----------------------------------------------------------