commerce_stripe_update_8103 does not handle database prefix

Created on 26 January 2025, about 19 hours ago

Problem/Motivation

Hi,

I am trying to update from commerce_stripe 8.x-1.1 to 8.x-1.2 and I got the following fatal error on commerce_stripe_update_8103 update:

[notice] Update started: commerce_stripe_update_8103
>  [error]  SQLSTATE[42S22]: Column not found: 1054 Unknown column 'commerce_payment_method__card_exp_month.entity_id' in 'WHERE': DELETE FROM "PREFIX_commerce_payment_method__card_exp_month" WHERE bundle = 'credit_card' and EXISTS (SELECT * FROM "PREFIX_commerce_payment_method" WHERE commerce_payment_method__card_exp_month.entity_id = commerce_payment_method.method_id and commerce_payment_method.type = 'stripe_card'); Array

I changed my actual database prefix by PREFIX in the copy/pasted error.

I think direct database queries like:

      $database->query("INSERT INTO {commerce_payment_method__stripe_card_exp_month} SELECT * FROM {commerce_payment_method__card_exp_month} cem WHERE cem.bundle = 'credit_card' and EXISTS (SELECT * FROM {commerce_payment_method} pm WHERE cem.entity_id = pm.method_id and pm.type = 'stripe_card') and NOT EXISTS (SELECT * FROM {commerce_payment_method__stripe_card_exp_month} scem2 WHERE cem.entity_id = scem2.entity_id);");

do not handle database prefix.

Steps to reproduce

Install commerce_stripe 8.x-1.1 on a website with a database prefix. Update to 8.x-1.2.

Proposed resolution

Rewrite the update code to use database insert/update/delete methods with abstraction layer.

Remaining tasks

🐛 Bug report
Status

Active

Version

1.2

Component

Code

Created by

🇫🇷France Grimreaper France 🇫🇷

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

Comments & Activities

Production build 0.71.5 2024