Database update fails after upgrading to 3.1.6

Created on 20 June 2025, 15 days ago

Problem/Motivation

SQL update #9107 fail with this error:
Drupal\Core\Database\SchemaException: MySQL needs the 'fid' field specification in order to normalize the 'fid_module_name' index in Drupal\mysql\Driver\Database\mysql\Schema->getNormalizedIndexes() (linea 329 di /var/www/drupal/core/modules/mysql/src/Driver/Database/mysql/Schema.php).

Steps to reproduce

Launch update.php script

🐛 Bug report
Status

Active

Version

3.1

Component

Miscellaneous

Created by

🇮🇹Italy tiziano.sartori

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

Comments & Activities

  • Issue created by @tiziano.sartori
  • 🇳🇱Netherlands clivesj

    Update 9107 is not passing the fid field definitions properly.
    I will have a fix for this soon.

    I have downgraded the issue to minor.
    The update failing only means that the table index is not created, which has no effect on the application other than that the projected increase in speed (with the index) is not achieved.

  • 🇮🇳India mageshbcet1

    Hello,

    We are also getting this issue during db update after Drupal 10 upgrade. This is blocker for D10 upgrade. When this issue will be fixed?

  • 🇮🇹Italy trickfun

    Same error for me.
    Drupal 10.5
    Thank you

    • clivesj committed 1ca3b747 on 3.1.x
      Issue #3531198: Database update fails after upgrading to 3.1.6
      
  • 🇳🇱Netherlands clivesj

    In this fix updates 9106 and 9107 are cancelled.
    Sites that successfully ran either of those updates will have the index on the table filebrowser_metadata_entity. Those where the updates failed will not.

    If you have a large table and want to improve the performance, you can manually add the index to the table by using a query like this one for your database installation:
    CREATE INDEX fid_module_name USING BTREE ON filebrowser_metadata_entity (fid, module, name);

    The automated process using the database abstraction layer does not work consistently across the various (versions of) databases and versions of Drupal. I have no time to further work on this.

Production build 0.71.5 2024