Upon activating the commerce shipping module, Drupal reports as follows:

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'robots_db.cache_commerce_shipping_rates' doesn't exist: TRUNCATE {cache_commerce_shipping_rates} ; Array ( ) in cache_clear_all() (regel 169 van /home/robots/public_html/includes/cache.inc).

Can I create this table manually, or is there a .sql-script I can use to create it manually?
Deactivating the module restores the Drupal site back to a working state. Removing the module from the modules directory, putting it back in the directory and activating the module again, reproduces the error in the exact same way.

Can anybody help me to get past this error, please?

Regards,
Chris

Comments

googletorp’s picture

Assigned: Unassigned » rszrama
rszrama’s picture

Status: Needs work » Postponed (maintainer needs more info)

Curious. Did you perhaps try to upgrade from Shipping 1.x to 2.x? If so, that isn't supported yet. Otherwise, that cache table gets created when you install 2.x and I don't know any reason for it to be missed.

matroos69’s picture

It was a clean install, directly 2.x. Is there a way that the table creation script can be isolated, so I could run the table creation script manually?

rszrama’s picture

Status: Postponed (maintainer needs more info) » Fixed
drupal_install_schema('commerce_shipping');
minneapolisdan’s picture

Thanks, I had the same issue, and this fixed it.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

wzoom’s picture

Status: Closed (fixed) » Needs review

Please add this code to the current dev version of commerce_shipping.install, it is still not there

/**
 * Implements hook_install().
 */
function commerce_shipping_install() {
	drupal_install_schema('commerce_shipping');
}

Thank you.

rszrama’s picture

Status: Needs review » Closed (fixed)

That's because it isn't necessary in Drupal 7. ; )

http://api.drupal.org/api/drupal/modules--system--system.api.php/functio...

garron’s picture

I have the same issue, but mine is because I installed 1.x before realizing that 2.x was what I needed. Is there a way to fix this without shell access or Drush? I uninstalled and even dropped the commerce shipping tables to try to get back to a fresh install. Is there a way to either re-running the installation script, or some SQL script to get 2.x running?

rszrama’s picture

If you've uninstalled Shipping 1.x, you might just try removing the Shipping module entirely and clearing your site cache. This should reset the system table in your site to not think the Shipping module is around / installed. If the problem is that you uninstalled Shipping 1.x with Shipping 2.x code on the server, maybe putting Shipping 1.x back on the site and uninstalling would sort it out.

garron’s picture

Ryan, thank you for your prompt attention to this. (I'm huge a fan, BTW.)
After restoring the database (after I deleted everything shipping from the database which mucked up my site amazingly) I physically deleted shipping from the modules folder, reloaded and re-installed the 1.x code and flushed cache. Weirdly enough, my modules page still read 2.x, along with UPS which wasn't even in the modules folder anymore. After dis-enabling 1.x shipping, I was able to uninstall the modules. Then in FTP I deleted the 1.x folder and flushed the cache again. It didn't seem to change anything. The modules page still has the 4 - 2.x shipping modules listed (1.x UPS), and the database still has the field_data_shipping_method table among others. I am at a complete loss. I know that 2.x will do everything I need, and my site completion is so close I can taste it. Any thoughts at all?
Thanks again.

rszrama’s picture

The persistence of that one field is likely due to the module not cleaning up its field data directly. That may just need to be added, but I imagine we'd clean that up as part of an update path from 1.x to 2.x. The deeper issue if you're getting conflicting version numbers like this is that you probably have multiple versions of the module in valid modules directories somewhere. Poke around and see where else you may have installed it.

garron’s picture

Yes, I believe you are right that it's a good fit for the 1.x to 2.x path. In my exasperation - instead of going on a drinking binge - I went through the process again of uninstalling (and praying) and reinstalling the 2.x version (and praying) and it suddenly started working. The module registry was somehow reset, and showed the proper files. Maybe some weird cache glitch? I have now gotten UPS and Flat Rate installed and it looks like everything is a go.
I personally appreciate that you guys hadn't yet devoted the time to mapping the 1.x upgrade in your hyperdrive push to deliver a solid shipping solution.
(Though I accidentally caught my scarf in the turbines.) Thanks again for your inspired work and for taking the time to help a lowly site builder.

rszrama’s picture

hehe Thanks for the feedback. : )

agileadam’s picture

This may be helpful to someone, so I'm posting it here.

I've recently had trouble on three different sites setting up commerce_shipping due to missing tables and fields in the DB. The easiest way I've been able to resolve the issues is by:

  1. Disabling commerce_shipping and any related modules
  2. Deleting tables in the database that have the word "shipping" in them (use caution)
  3. Deleting fields from the field_config table that have "shipping" in the field_name (use caution)
  4. Deleting fields from the field_config_instance table that have "shipping" in the field_name (use caution)
  5. Enabling the module(s) again
  6. NOTE: For some reason, at this point, it's still missing the cache "rates" table...
  7. Executing drush eval 'drupal_install_schema('commerce_shipping');'

It was only after doing those steps that commerce_shipping worked. It could be because Commerce Shipping v1 was installed and not completely removed before installing v2, but I cannot be sure.