Primary key in file_managed_data

Created on 22 June 2023, over 1 year ago
Updated 10 April 2024, 7 months ago

Drupal 10.1.0 report page show an error:

Transaction isolation level
READ-COMMITTED
For this to work correctly, all tables must have a primary key. The following table(s) do not have a primary key: file_managed_data.

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Miscellaneous

Created by

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

Comments & Activities

  • Issue created by @LoranRendel
  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    Confirmed! Only seems to happen with Gutenberg installed. See /admin/reports/status

  • Assigned to szeidler
  • πŸ‡©πŸ‡ͺGermany szeidler Berlin

    Interesting. The whole table seems to be related to the build-in media library that comes with the Gutenberg module and is only used, when the "Media Library" from Core is not installed.

    We should add the primary key as long keep the feature.

  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update over 1 year ago
    Waiting for branch to pass
  • πŸ‡©πŸ‡ͺGermany szeidler Berlin

    Here's a patch. Please keep in mind that applying patches with hook_update_N to real world applications are risky, because there is the chance that another patch with an update function gets committed first.

  • Status changed to RTBC over 1 year ago
  • πŸ‡΅πŸ‡ΉPortugal dubois

    Simple change, patch works, not much more to say here. Would be great to get it merged soon to avoid hook_update_N issue mentioned by @szeidler.

  • First commit to issue fork.
  • Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update over 1 year ago
    Waiting for branch to pass
  • @codebymikey opened merge request.
  • Status changed to Needs review over 1 year ago
  • Updated the default gutenberg_schema() entry so that new module installs should have the fid as the primary key, and created a PR for it.

    Just needs review/testing from @szeidler, and he can merge it in.

  • Status changed to RTBC over 1 year ago
  • πŸ‡©πŸ‡ͺGermany szeidler Berlin

    Good and important catch @codebymikey.

    Looks good!

  • Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update over 1 year ago
    Waiting for branch to pass
  • Status changed to Fixed over 1 year ago
  • πŸ‡©πŸ‡ͺGermany szeidler Berlin

    Merging the change in. Thanks for your contributions.

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

  • Status changed to Fixed 7 months ago
  • πŸ‡ΊπŸ‡ΈUnited States bwoods

    I think this patch may have unintended consequences. Today I upgraded from D9 to D10. When I attempted to run database updates, I was stuck on this patch. I do not have a table file_managed_data, only files_managed. I was able to move past this by duplicating files_managed as files_managed_data. After the migration, I tested my content, and no files/data are being inserted into file_managed_data, so I just removed the unnecessary file_managed_data table.

  • πŸ‡©πŸ‡ͺGermany szeidler Berlin

    We could of course have added a table exist check on the update hook, but I'm just surprised that the table does not exist for your since it's defined as hook_schema + was added as an update hook for existing sites years ago.
    Do you know since when the site has been using Gutenberg? Have you been an early adopter?

Production build 0.71.5 2024