Problem with Calendar after upgrading to 3.1

charliebillups wrote on Friday, February 11, 2011:

I am upgrading my system on windows 2003 server from 3.0.1 to 3.1 because i dont know if you can just upgrade to 3.2. I am getting this error. I have ran the upgrading procedure 3 times and on 2 different system and I always get this error after loging in.

ERROR: query failed: select distinct id, username, lname, fname, authorized, info, facility from users where username != ‘’ and active = 1 and id like ‘%’ AND authorized=1 AND ( info IS NULL OR info NOT LIKE ‘%Nocalendar%’ ) AND (facility_id = 3 OR 3 IN (select facility_id from users_facility where tablename = ‘users’ and table_id = id) ) ORDER BY lname, fname

Error: Table ‘openemr.users_facility’ doesn’t exist

Thank you so much for your help! Anyone out there.

aethelwulffe wrote on Friday, February 11, 2011:

OK…
  I had this issue too.
This table does not do much.  It allows you to use (I seem to recall) the “restrict users to default facility” (*ahem*) “feature”.

  I had the problem in that it did not exist when I turned this feature on to see what it did.  I changed settings in globals to turn this off, and I had no more problems for a bit, but then I needed to upgrade again and there it was.  Well, I kept trying to add the table using phpmyadmin, but it kept telling me the table already existed even though it wasn’t in the list!  Then I would try to delete a table by that name, and it would respond that the table didn’t exist!  Catch 22.
  Here is what I remember working:

0.  Shut down apache, mysql, and xampp_control.exe. (turned off the server).

1.   Backed up everything like 3 times…multiple locations.

2.  I went into mysql\data\openemr and deleted the files that were named users_facility.  I remember that they were not a full set of files, and may have only been there because of previous tinkering…but check for them anyway.

3.  Fired up a copy of the new EMR version and looked at the table to get it’s specifications.

4.  I then tried on the old EMR to delete and create the table in phpmyadmin.  I think that worked, but I may have tried something really silly like copying the good C:\xampp\mysql\data\openemr\users_facility.frm file into the old version, THEN trying to add it or delete it.

Somewhere, something worked.  The table is in the database, and has no data in it (no .MYD or .MYI files in the database).  It sits there, behaves, and gives me no further trouble up through version 4.0.

 

charliebillups wrote on Friday, February 11, 2011:

ok, this was a wonderful learning process for me. After you upgrade to version 3.1 even though the calendar works. Upgrade to version 3.2 that does the trick.  The upgrade to version 3.1 is defective and does not work.

Thanks

Charlie