Upgrading to LedgerSMB 1.3

From LedgerSMB 1.3:

First, upgrade 1.3 to the latest version.  This ensures a stable version for
migration purposes.

Once 1.3 has been upgraded to the latest 1.3 release, then untar over the top 
and then select step 1 or 2:

1)  Automated process (all platforms):

* direct browser to the setup.pl file in the directory you are in.
* provide PostgreSQL superuser credentials and the name of your data base.
* Click continue.
* [Optionally] Click 'Backup DB' and/or 'Backup Roles'.
* Click 'Yes', answering "LedgerSMB 1.3 found. Rebuild/Upgrade?"
* Repeat for each database.

2) Shell script process (UNIX/Linux only):

* cd to the sql/modules directory of the ledgersmb installation.
* sh reload_modules.sh [dbname]
* repeat the shell script for each database.



From LedgerSMB 1.1 and earlier:

For versions prior to 1.2, please upgrade to LedgerSMB 1.2 before upgrading to 
1.3.x.  To do this upgrade, simply untar the version of 1.2.x over your old
installation and run the relevant database upgrade scripts (in
sql/upgrade/legacy).  Then proceed below.

From LedgerSMB 1.2.x

* Untar over the top.
* Check your Perl dependencies:
   * cpanm --notest --quiet --installdeps .
* run the install.sh script.
* fix ledgersmb.conf with new config
  copy ledgersmb.conf to ledgersmb.conf.old
  copy ledgersmb.conf.default to ledgersmb.conf and reconfigure.
* direct your browser to the setup.pl script in your ledgersmb directory (via
  http) and follow the prompts:
   * Provide Pg superuser and database information for your existing database
     (the database created for your company)
   * Click continue when asked to upgrade
   * When asking for upgrade info:
       * contrib_dir is the directory where either tablefunc.control or 
         tablefunc.sql is, depending on your PostgreSQL version (9.1 and higher 
         would use tablefunc.control)
       * Default country is the country to map contacts which have no country 
         information to.  This is the short, two letter ISO code for the 
         country, such as AU for Austria, or US for United States.  It is 
         case insensitive.
       * Default ar/ap accounts provide links to accounts for purposes of
         selection among multiple AR/AP accounts, and for purposes of payment
         reversals.  Enter account numbers here, like 1200 for AR and 2100 for
         AP
   * Provide user information. 
     Note: users are recreated as PostreSQL db users with application acess instead 
     of just imported from your 1.2.x install. New users created by the administrative 
     functions have their password auth timing out after a day, unless they change their 
     passwords after logging into LedgerSMB. 
   * log into the application and create additional users under System/User
     Management

ROLLING BACK AN UPGRADE
=========================

LedgerSMB upgrades are non-destructive and work by moving data to the side,
adding mapping data, and then populating a new LedgerSMB schema.  The data is retained in an old schema, with a naming convention like lsmbnn (for LedgerSMB) or slnn (for SQL-Ledger).  The following schemas are used currently:

lsmb13: LedgerSMB 1.3
lsmb12: LedgerSMB 1.2
sl28:  SQL-Ledger 2.8

We include downgrade scripts for previous LSMB versions.  This works by removing
the mapping the data and restoring the old schema.  Changes made in the process 
of preparing for upgrades (the test screens for unique identifiers etc) are
preserved but nothing else is.

The downgrade scripts assume that LedgerSMB is installed in the public schema.
If this is not the case, then the scripts will have to be edited before running.

UPGRADING INTO A NON-STANDARD SCHEMA
====================================

The installation and upgrade scripts are schema-agnostic.  They install the 
components into the first available schema on the installing super-users 
search_path.

This should be done for users of the software too (using alter database or alter
user), and it must also be configured in the ledgersmb.conf.
