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.

Issue fork visitors-3454296

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

lightweight created an issue. See original summary.

lightweight’s picture

Issue summary: View changes
bluegeek9’s picture

Thank you for reporting this bug. I hope to have a fix soon.

bluegeek9’s picture

Assigned: Unassigned » bluegeek9

  • bluegeek9 committed c780f818 on 8.x-2.x
    Issue #3454296 by bluegeek9: Schema update fails with 8.x-2.16->2.18...
bluegeek9’s picture

Assigned: bluegeek9 » Unassigned
Issue summary: View changes
Status: Active » Fixed
bluegeek9’s picture

https://www.drupal.org/project/visitors/releases/8.x-2.19

//www.flaticon.com/free-icons/thank-you Thank you for your contribution! Your continued support to this project makes other volunteer contributions more sustainable.
There are multiple ways to show appreciation for the work contributed to this project including:
  • Triaging issues and adding more context to existing issues.
  • Writing documentation or patches for this project.

Status: Fixed » Closed (fixed)

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