Problem/Motivation

The salesforce_push_update_8004() update fails if there is no queue table in the database. The error message is the following:

Cannot add field 'salesforce_push_queue.last_failure_message': table doesn't exist.

In addition, the update uses the table schema provided by the runtime service. It's pretty much the same as using hook_schema() in an update. There is a paragraph in the hook documentation about this approach:

... So, when updating a database table or field, put the schema information you want to update to directly into your function instead of calling your hook_schema() function to retrieve it (this is one case where the right thing to do is copy and paste the code).

The reason is that any change to the runtime table schema would unintentionally change the hook_update_N() implementation too. However, an update must not change its behavior.

Steps to reproduce

  • Install a version of the module without this update, e.g. 5.0.0.
  • Immediately upgrade to a version with the update, e.g. the latest 5.0.2.
  • Run drush updb or run the update through a browser.
  • The update fails with the error described above.

Proposed resolution

It should check if the table exists in the database. And, it shouldn't rely on the table schema provided by the runtime service.

Remaining tasks

The patch needs a review / feedback.

User interface changes

No.

API changes

No.

Data model changes

No.

CommentFileSizeAuthor
#2 salesforce-3350924-2.patch1.37 KBdmitriy.trt

Comments

Dmitriy.trt created an issue. See original summary.

dmitriy.trt’s picture

Assigned: dmitriy.trt » Unassigned
Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new1.37 KB

The attached patch fixes the failure. It also removes usage of the runtime service.

dmitriy.trt’s picture

Issue summary: View changes
damienmckenna’s picture

Status: Needs review » Reviewed & tested by the community

That solved the problem for us, thank you.

blanca.esqueda’s picture

Thanks, that solved the issue for us as well!

aaronbauman’s picture

Status: Reviewed & tested by the community » Fixed

Committed to latest dev, thanks for the patch

Status: Fixed » Closed (fixed)

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