I have tried to update using the new November 8th library module. I have tried that update and the CVS head version and I am getting sql errors:

user warning: Unknown column 'lt.uid' in 'field list' query: SELECT lt.created, lt.tid, la.aid, la.name as "action_name", la.status_change, lt.uid, lt.item_id, lt.duedate, lt.notes, l.in_circulation, l.barcode, n.title as "item_name", n.nid FROM library_transactions lt, library_actions la, library l, node n WHERE la.aid = lt.action_aid AND n.nid = l.nid AND lt.item_id = l.id AND l.id = 3 ORDER BY lt.created DESC in /sites/all/modules/library-HEAD/library.module on line 1010.

I still have all of the database tables, so it must have something to do with the code. I did have "Associate Library Patrons with Drupal Users" enabled. If, however, I start with a fresh installation, everything is fine. Am I missing something?? I just updated the modules and ran the update.php for drupal. I didn't do anything else.

Comments

grahl’s picture

Sounds like you were missing the empty patron.module file as indicated here:
http://drupal.org/node/970926

The error is pretty much what I'd expect to happen if updates 6201-6204 had not been applied.

daengo’s picture

o.k. in library-HEAD/patron I have an empty patron.module file. I've ran update.php again, dumped the drupal cache and ran cron.php and I still get the error. Did I have to have it in the folder before I ran update.php or at some other point?

grahl’s picture

Well, 6201-6204 ran but didn't do anything, so Drupal now thinks you're currently at version 6204. You can either play back a backup from before you ran update.php, or increment the update hooks in the install file by hand to 6205-6208, the latter might cause you problems if the module should later use those hook versions. Alternatively you can dig in the database where the module version is tracked and change that back if you don't have a database backup (which would be pretty brave, considering all the moving and deleting).

daengo’s picture

that's a little advanced for me at this point but what i did do is restore a backup, ran the cvs update and did a touch patron.module in the patron folder and then ran update.php. It failed saying something about associating drupal users with patrons (which I already had enabled to begin with). So I went to admin/build/modules and disabled patron and then re-ran update.php and saw that it updated. Still the same issue though. Is there any chance that the main dev download will just be updated soon?

grahl’s picture

When you disabled patron you ran the updates the same way as before when patron.module was missing. The warnings were most likely telling you that have some patrons which do not have a user account associated with them. If you fix those, the upgrade should run fine.

jastraat’s picture

All patrons have to have an associated user for this update to run. One of the easiest ways to check is to make sure that every row in the library_patrons table has a populated patron_uid. Merely having 'associate patrons with users' checked is not enough.

Patron needs to be enabled for the updates to run. It will automatically disable itself and uninstall when the update is complete.

Also - please don't pull the HEAD branch. Test against the 6.x-2.x branch. I'm continuing to work in HEAD -
Thanks!

daengo’s picture

Rats! I see part of my problem. I have numerous messed up patron_uid numbers in my database that I suspect are messing things up too. I'll have to wait until I can get our patrons to bring back all of our checked-out equipment, uninstall the library module and install the new version. I won't have the history, but that's the least of my concern. I just want to get rid of the patron association thing.

jastraat’s picture

This could definitely happen if for some reason you started associating patrons with users after using the module for a while - or if you happened to delete a user who was associated with a patron node. Depending on how important history is to you, I'd suggest trying to do a SQL query to find out what patrons don't have valid user ids. Something the the effect of:
select * from library_patrons where patron_uid = 0 OR patron_uid IS NULL OR patron_uid NOT IN (select uid FROM users)
Those are the ones you need to worry about. If it's not too long a list or if none of those folks have checked out items, you could try cleaning those records and/or deleting those patrons before trying the upgrade again.

daengo’s picture

O.k. I'm thinking you (and grahl) must be some kind of geniuses or something, because so far that has worked perfectly. I'll let you know if I find any issues.

jastraat’s picture

Status: Active » Closed (works as designed)

It sounds like this was resolved.