Beta 2 Update

Posts: 37
Joined: 09/30/2007

Hello Ryan,

I just updated to Beta 2. I downloaded the Beta 2, untared it, copied it to my: sites/all/modules/ubercart directory, backup my site, uploaded the ubercart directory, and then ran update.php.

I got the following error messages. This is error shows on the site whether I'm logged in or not. What's the best way to make it go away?

user warning: Table 'refineda_drpl1.uc_flatrate_methods' doesn't exist query: SELECT mid, title, label FROM uc_flatrate_methods in /home/refineda/public_html/includes/database.mysql.inc on line 172.

Thanks,

Posts: 1293
Joined: 08/14/2007
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.

Uninstall and reinstall the flatrate module, from the looks of it...

--

"Pain don't hurt." - Dalton

Mike Nelson's RiffTrax! www.rifftrax.com

Posts: 37
Joined: 09/30/2007

Thanks, I'll try that.
I realized I had a product in the cart. I removed and ran update again and cut it down to just one error message.

user warning: Table 'refineda_drpl1.uc_flatrate_methods' doesn't exist query: SELECT mid, title, label FROM uc_flatrate_methods in /home/refineda/public_html/includes/database.mysql.inc on line 172.

I'll try the reinstall.

Thank, torgosPizza

Posts: 37
Joined: 09/30/2007

Hi,

I just reinstalled the entire shipping module and ran update. The error persisted, to wit:

user warning: Table 'refineda_drpl1.uc_flatrate_methods' doesn't exist query: SELECT mid, title, label FROM uc_flatrate_methods in /home/refineda/public_html/includes/database.mysql.inc on line 172.

I went to workflow_ng and unenabled the flat rate shipping, so that is no longer active and ran update again.

The Status Report indicates that the database schema is out of date. Ran the database update script and that still did not fix the problem. My database does not show a uc_flatrate_methods table. Or do I go edit the inc file line 172?

Posts: 37
Joined: 09/30/2007

It would not be good to edit line 172 as it is an error routine:

if ($debug) {
print 'query: '. $query .'error:'. mysql_error($active_db) .'';
}

if (!mysql_errno($active_db)) {
return $result;
}
else {
trigger_error(check_plain(mysql_error($active_db) ."\nquery: ". $query), E_USER_WARNING);
return FALSE;
}
}

The trigger_error is line 172.

Posts: 5269
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Hmm... the table is created in the module's install file and update files. When you uninstalled the flatrate module earlier, after disabling it did you explicitly click on the "Uninstall" tab at the top of the modules page and remove it there, too?

Posts: 37
Joined: 09/30/2007

Hello Ryan,

Essentially, the install file had a case install statement to create the uc_flatrate_methods db table. The case statement had nothing in the case of "mysql," and the case below showed the create db in the "mysqli" case. Since there was no break, the "mysql" case should have dropped to the "mysqli'case and the db created. It was not. I looked for some sort of code error, but did not see anything in the include file.

I looked through the rest of the include and saw the uc_flatrate_method was used a lot.

What I did was manually create the uc_flatrate_methods table in the db through the php db administrator on the server site, as described in the include file. Then ran update.php and the problem disappeared.

Don't know why the db was not created, but the manual creation seemed to fix the problem.

Dale

Posts: 924
Joined: 11/05/2007
Bug FinderFAQ ModeratorGetting busy with the Ubercode.

One thing I've noticed (and this is a Drupal thing, not an Ubercart thing):

If you've installed a module, then disable (but don't uninstall) the module, the module's tables remain in the DB. No problem so far...

But if you download a new version of that module and run update.php, the update_N() function for that disabled module is *not* executed, because the module is not enabled! This leaves you with an outdated set of DB tables for that disabled module. If you later enable that module, the code and the DB tables will be out of sync. This causes problems especially during development when you're constantly enabling/disabling modules and updating code.

Because the uc_flatrate_method table wasn't present in older versions of uc_flatrate, I'll bet your old install didn't have that table, and you also had uc_flatrate disabled when you did the update.php. As a result, the uc_flatrate_method table didn't get created by the update and you got errors when you later enabled the uc_flatrate module and tried to use it.

To avoid this problem, a workaround is to always run update.php after you enable a module.

--

<tr>.

Posts: 37
Joined: 09/30/2007

That's good information. I did notice that the uc_flatrate_method table was indeed not present in the older version.

However, I had uc_flatrate enabled when I did the initial update, the initial update.php, and got the error.

It turned out I had an item in the cart. I do not know think that mattered. After the error appeared, I disabled the uc_flatrate in workflow_ng, but did not disable the module, and took out the product from the cart, and ran update.php again, but got the same error.

This may seem at odds with what you said above, but I believe that the cache had something to do with showing the error when it may have been corrected. I had to delete the cache, via the drupal developer module to get the error out of my browser. And I also repaired the MySQL db on the server, when after creating the table manually it did not show up in the db structure. Now, everything seems ok.

So your explanation may be correct. I can't say since I'm not sure if the browser was telling current info after I ran update.php, or whether the db structure was there until I did the db repair.

I think your suggestion of running update.php when you enable a new module is a good suggestion, and something I'll include in my bag of tricks. Thanks.

Posts: 37
Joined: 09/30/2007

No, I didn't Ryan. I will next time. Thanks.