Bug 11389: reenable Pg as a DB scheme that Koha can connect to
authorGalen Charlton <gmc@esilibrary.com>
Thu, 12 Dec 2013 23:55:14 +0000 (23:55 +0000)
committerGalen Charlton <gmc@esilibrary.com>
Mon, 13 Jan 2014 20:56:14 +0000 (20:56 +0000)
commit5920ca6fa02d65e2a2b9076d08444a4cd6a157a9
treec1b8974979acf171dd6f360741c1ec7fac876cf8
parentb7b1db5c81eb67e51851efc5bc2d1fb2a0cb7d04
Bug 11389: reenable Pg as a DB scheme that Koha can connect to

This patch restores the ability to request a DBI database handle
or a DBIx::Class schema object connected to a PostgreSQL database.

To address the concerns raised in bug 7188, only "mysql" and "Pg"
are recognized as valid DB schemes.  If anything else is passed
to C4::Context::db_scheme2dbi or set as the db_scheme in the Koha
configuration file, the DBD driver to load is assumed to be "mysql".

Note that this patch drops any pretense of Oracle support.

To test:

[1] Apply patch, and verify that the database-dependent tests
    pass when run against a MySQL Koha database.
[2] To test against PostgreSQL, create a Pg database and
    edit koha-conf.xml to set db_scheme to Pg (and adjust
    the other DB connection parameters appropriately).  The
    following tests should pass, at minimum:

    t/Context.t
    t/db_dependent/Koha_Database.t

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, some additional notes:

- Installed Postgres following
  http://wiki.ubuntuusers.de/PostgreSQL
- Created a database user koha
- Created a database koha
- Changed the koha-conf.xml file
    <db_scheme>Pg</db_scheme>
    <database>koha</database>
    <hostname>localhost</hostname>
    <port>5432</port>
    <user>koha</user>
    <pass>xxxx</pass>
- Installed libdbd-pg-perl
- Ran the web installer until step 3 everything looked ok
  Step 3 complains:
    Password for user koha: psql: fe_sendauth: no password supplied
- Both t/Context.t and t/db_dependent/Koha_Database.t pass

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
C4/Context.pm
Koha/Database.pm
etc/koha-conf.xml
t/Context.t