I updated a site with Ubercart from Drupal 5 to Drupal 7, with an obligatory pitstop at Drupal 6.
In Drupal 5, the uc_payment_receipts 'data' field was set to NOT NULL. Is it possible that this was not modified in the upgrade path?
On my install the field was still NOT NULL after all the updates, and this was preventing any orders from being completed because uc_payment_enter() would generate an Integrity constraint violation exception when running db_insert() with the default NULL value for $data.
Short version: if you have a problem where your orders are never set to Completed after Paypal Express payments, try changing the 'data' field of your uc_payment_receipts table to allow for NULL values.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 1593618-uc_payment-d5-upgrade.patch | 536 bytes | longwave |
Comments
Comment #0.0
jmlavarenne commentedTypos
Comment #1
longwaveInteresting, thanks for the analysis.
Manual test case for this would be install D5/Ubercart 1.x, upgrade to D6/UC2, upgrade to D7/UC3, then install http://drupal.org/project/schema and see what it reports.
Comment #2
tr commentedThere were a lot of schema problems in the D5 version of Ubercart, so I'm quite certain that there are some schema changes over the past four years that weren't handled by update functions. The question is what to do at this point, since D5 is no longer supported so we no longer support the D5->D6 upgrade which is where the vast majority of these problems would arise.
You can, of course, go directly into your database and change the schema manually if you find a problem like this. IMO that's the recommended course of action, and it's a small price to pay for such a big upgrade! I don't think it's appropriate to add a hook_update_7xxx() to change the schema if the D7 schema is the same as the D6 schema, which is the case here. And I'm not going to add a hook_update_6xxx() to deal with D5->D6 upgrades at this point. We simply don't have the manpower or time (all volunteer) to support an obsolete version of Drupal and Ubercart.
Comment #3
jmlavarenne commentedSounds good - next person who is struggling with this issue might be happy to stumble upon this when it shows up in some search result :)
Comment #4
longwaveDid a quick test on an old D5 database I had lying around, converting it to D6 and running Schema against it. Lots of differences in default values which I think we can safely ignore, which leaves the following:
uc_payment_receipts
column data - difference on: not null
declared: array('description' => t('TODO: please describe this field!'), 'type' => 'text')
actual: array('description' => t('TODO: please describe this field!'), 'type' => 'text', 'not null' => TRUE)
uc_orders
column host - difference on: length
declared: array('description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '')
actual: array('description' => t('TODO: please describe this field!'), 'type' => 'varchar', 'length' => '16', 'not null' => TRUE, 'default' => '')
uc_order_admin_comments
column message - difference on: not null
declared: array('description' => t('TODO: please describe this field!'), 'type' => 'text')
actual: array('description' => t('TODO: please describe this field!'), 'type' => 'text', 'not null' => TRUE)
uc_order_comments
column message - difference on: not null
declared: array('description' => t('TODO: please describe this field!'), 'type' => 'text')
actual: array('description' => t('TODO: please describe this field!'), 'type' => 'text', 'not null' => TRUE)
uc_order_log
column changes - difference on: not null
declared: array('description' => t('TODO: please describe this field!'), 'type' => 'text')
actual: array('description' => t('TODO: please describe this field!'), 'type' => 'text', 'not null' => TRUE)
uc_order_products
column data - difference on: not null
declared: array('description' => t('TODO: please describe this field!'), 'type' => 'text')
actual: array('description' => t('TODO: please describe this field!'), 'type' => 'text', 'not null' => TRUE)
uc_products
indexes nid: missing in database
uc_store_footers
column message - difference on: not null
declared: array('description' => t('TODO: please describe this field!'), 'type' => 'text')
actual: array('description' => t('TODO: please describe this field!'), 'type' => 'text', 'not null' => TRUE)
If uc_payment_receipts is causing a problem we should fix it, the rest I think we can leave except perhaps we should ensure there is an index on uc_products.nid.
Comment #5
longwavePatch for the uc_payment_receipts issue in D6, will need forward porting to D7 for sites that have already upgraded.
Comment #6
longwaveCommitted. If anyone needs this in D7 please reopen.
Comment #7.0
(not verified) commentedTypos