[OPEN-ILS-DEV] Minor change needed in 1.4 upgrade scripts

Mike Rylander mrylander at gmail.com
Thu Apr 9 14:42:39 EDT 2009


On Thu, Apr 9, 2009 at 2:22 PM, John Craig
<jc-mailinglist at alphagconsulting.com> wrote:
> Hi Folks,
>
> I'm not certain what this is doing (haven't gotten far enough in
> experimenting w/ 1.4 to know), but there's a problem in the 1.4 upgrade
> scripts. For example, in
>
> 1.2.3-1.4-upgrade-db.sql
>
> At the end of the file (after the commit--so it doesn't do anything except
> make trouble as you try to chase back through to see what the problem was)
> says:
>
> INSERT INTO config.circ_matrix_ruleset
> (matchpoint,duration_rule,recurring_fine_rule,max_fine_rule) VALUES
> (1,11,1,1);
>
> Trouble is, if you do not have a config.rule_circ_duration_rule.id = 11, you
> fail the integrity constraint and the way the error is displayed, you can't
> tell if this is a deferred constraint and the whole shooting match failed or
> what (yes, that's what happened to me/us here). (Could fail on the other
> rules too, but less likely, I suspect: most folks will have an id = 1 entry
> in config.rule_recuring_fine and config.rule_max_fine.)

That id of 11 is based on an earlier upgrade script that inserted a
rule called "default" with a pinned id of 11.  So, it's making a
naughty assumption, but (all else being equal) should work when it's
needed.

However, it was lazy of me to do things that way ... so, I'll suggest
an alternative to your alternative:

INSERT INTO config.circ_matrix_ruleset
(matchpoint,duration_rule,recurring_fine_rule,max_fine_rule)
  SELECT  d.id, f.id, m.id
    FROM   config.rule_circ_duration d
                JOIN config.rule_recuring_fine f ON (f.name = d.name)
                JOIN config.rule_max_fine m ON (f.name = m.name)
    WHERE m.name = 'default';

Eh?

Thanks, John, for pointing out the deficiency.

-- 
Mike Rylander
 | VP, Research and Design
 | Equinox Software, Inc. / The Evergreen Experts
 | phone:  1-877-OPEN-ILS (673-6457)
 | email:  miker at esilibrary.com
 | web:  http://www.esilibrary.com


More information about the Open-ils-dev mailing list