[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Much more evolved database preparation script



On Thu, 26 May 2011 15:55:09 -0700
Chris Travers <..hidden..> wrote:

> The larger problem is that it makes it impossible to run parallel
> versions side by side, because Perl will pull the module out of
> site-perl first, meaning that the copy in the local directory is
> ignored.

I think it might be better to use a custom directory for all the
Perl modules (say /usr/share/ledgersmb/<version>/lib) and make sure
that all Perl scripts have an appropriate "use lib xxx;" line in them.
Alternatively, for testing, you can override the PERL5LIB environment
variable or invoke Perl with explicit -I switches to make sure you get your
local modules rather than the site_perl ones.

Now my 2 cents: I think the installation script should be written in
Perl, not shell script.  Shell is too finicky.  The database setup
should be done from a separate Perl script using DBI rather than
invoking psql on the command line.  This makes it really easy to do
schema upgrades (having Perl logic available to munge data during an
upgrade makes a lot of tricky things much easier---sometimes a schema
change must be accompanied by some data manipulation as well.)

Our (commercial) product works this way and although it's not
open-source, I'm willing to donate the database initialization and
upgrade code to LedgerSMB if there's interest.  If I have time, I'll
try to adapt it to LedgerSMB, or I can just show it to LSMB developers
first so they can evaluate whether or not it's a good idea.

Regards,

David.