wiki:sysadminSwappingPatronBarcode

Version 1 (modified by Art Rhyno, 13 years ago) (diff)

--

Swapping a patron barcode

Sometimes we want to revert a barcode that has previous been marked lost. We do this through the actor.card table using the appropriate key from the actor.user table:

conifer=# select * from actor.card where usr=114622;
  id   |  usr   |    barcode     | active
-------+--------+----------------+--------
 78633 | 114622 | 21862000222221 | t
 61591 | 114622 | 21862000837508 | f

So we reverse which card is active:

UPDATE actor.card SET active='f' where id=78633;
UPDATE actor.card SET active='t' where id=61591;

and then we must update the actor.user to set the new value:

UPDATE actor.usr SET card=61591 where id=114622;