[OPEN-ILS-DEV] Functions for updating the call number label or owning_lib associated with a copy

Dan Scott dan at coffeecode.net
Thu Apr 14 09:36:02 EDT 2011


On Thu, Apr 14, 2011 at 08:17:54AM -0400, Ben Ostrowsky wrote:

<snip>
 
> They are indeed intended for manual DB calls, or for abstracting this
> process within other internal code. Comes in handy if you want to add (or
> remove) "MYS " at the beginning of the call numbers of all copies in a
> location called 'Mysteries', for example.

I would probably just bash out something like:

UPDATE asset.call_number SET label = 'MYS ' || label
  WHERE id IN (
    SELECT acn.id
      FROM asset.call_number acn
        INNER JOIN asset.copy ac ON ac.call_number = acn.id
        INNER JOIN asset.copy_location acl ON acl.id = ac.location
      WHERE acl.name = 'Mysteries'
  ) AND label NOT LIKE 'MYS %';
;

I'm not sure we have many utility functions defined as part of the stock
schema that are intended to be invoked directly by humans, rather than
to support the application. To date, most of these things have lived in
the wiki (ye olde "Magic spells") and have had a corresponding level of
support. 

I worry a little bit about testing, etc as schemas change over time, and
would lean towards gathering these sorts of admin functions in one place
in the wiki until there's a critical mass, perhaps - and then gather
them under a single schema ('egadmin' or something like that?), and come
up with a way of automatically testing them going forward, before
committing them to the core schema.


More information about the Open-ils-dev mailing list