salesforce_push_update_8004() fails because of missing queue table

Created on 28 March 2023, about 2 years ago
Updated 31 March 2023, about 2 years ago

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.

πŸ› Bug report
Status

Fixed

Version

5.0

Component

salesforce_push.module

Created by

πŸ‡΅πŸ‡ΉPortugal dmitriy.trt

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024