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 updbor 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.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | salesforce-3350924-2.patch | 1.37 KB | dmitriy.trt |
Comments
Comment #2
dmitriy.trt commentedThe attached patch fixes the failure. It also removes usage of the runtime service.
Comment #3
dmitriy.trt commentedComment #4
damienmckennaThat solved the problem for us, thank you.
Comment #5
blanca.esqueda commentedThanks, that solved the issue for us as well!
Comment #7
aaronbaumanCommitted to latest dev, thanks for the patch