Schema update fails with 8.x-2.16->2.18 upgrade

Created on 13 June 2024, 7 months ago
Updated 27 June 2024, 6 months ago

Problem/Motivation

When running module updates after upgrading from 8.x-2.16 to 8.x-2.18 (as part of core upgrade to 10.2.7), the update fails due to two errors:

ArgumentCountError: Too few arguments to function Drupal\mysql\Driver\Database\mysql\Schema::addIndex(), 3 passed in /var/www/html/web/modules/contrib/visitors/visitors.install on line 1072 and exactly 4 expected in /var/www/html/web/core/modules/mysql/src/Driver/Database/mysql/Schema.php on line 571 #0 /var/www/html/web/modules/contrib/visitors/visitors.install(1072): Drupal\mysql\Driver\Database\mysql\Schema->addIndex('visitors', 'visitors_uid', Array)

ArgumentCountError: Too few arguments to function Drupal\mysql\Driver\Database\mysql\Schema::addIndex(), 3 passed in /var/www/html/web/modules/contrib/visitors/visitors.install on line 1204 and exactly 4 expected in /var/www/html/web/core/modules/mysql/src/Driver/Database/mysql/Schema.php on line 571 #0 /var/www/html/web/modules/contrib/visitors/visitors.install(1204): Drupal\mysql\Driver\Database\mysql\Schema->addIndex('visitors', 'bot', Array)
app-1 | #1 /var/www/html/web/core/includes/update.inc(171): visitors_update_8217(Array)

Proposed resolution

https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Database%...

This isn't a resolution - someone would need to understand the '$fields' argument and how it might apply in this context to be able to propose a full resolution... but I was able to 'fix' the issues by temporarily editing visitors/visitors.install to add a ', null,' as the third argument ($fields) of both calls to schema()->addIndex(). This allowed the update to proceed without further issues. I suspect the many calls to addIndex (all with 3 arguments) will lead to similar problems in future.

πŸ› Bug report
Status

Fixed

Version

2.18

Component

Code

Created by

πŸ‡³πŸ‡ΏNew Zealand lightweight

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024