Missing primary key in table `restrict_ip_paths' and `restrict_ip_whitelisted_ip_addresses'

Created on 7 September 2023, 10 months ago
Updated 4 January 2024, 6 months ago

Hi,

When the Transaction Level in MariaDB is set to READ-COMMITTED, the following warning appears on the report page (/admin/reports/status).

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: forum_index, honeypot_user, restrict_ip_paths, restrict_ip_whitelisted_ip_addresses. See the setting MySQL transaction isolation level page for more information.

# My site is on Drupal version 10.1.2.

Reference URL:
https://www.drupal.org/docs/getting-started/system-requirements/setting-the-mysql-transaction-isolation-level

Can you please consider supporting this?

🐛 Bug report
Status

Needs review

Version

4.0

Component

Code

Created by

🇯🇵Japan Ryo Ichiyama

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

Comments & Activities

  • Issue created by @Ryo Ichiyama
  • 🇮🇳India sarwan

    I have fixed this issue
    Missing primary key in table `restrict_ip_paths' and `restrict_ip_whitelisted_ip_addresses'
    and also attached patch.

  • 🇯🇵Japan Ryo Ichiyama

    Thank you for responding so quickly.
    I have patched and reinstalled the module and have confirmed that the warning is gone.

  • drush eval "\Drupal\Core\Database\Database::getConnection()->schema()->addPrimaryKey('restrict_ip_whitelisted_ip_addresses', ['ip_address']);"
    drush eval "\Drupal\Core\Database\Database::getConnection()->schema()->addPrimaryKey('restrict_ip_paths', ['path']);"

    do these if you don't want to reinstall it

  • Status changed to Needs review 6 months ago
  • 🇺🇸United States mmenavas

    Here's an updated patch that combines @andikanio's suggestion as a database update hook and @sarwan_verma's patch.

  • 🇯🇵Japan Ryo Ichiyama

    @andikanio , @mmenavas

    Thank you very much.
    If I can get my environment back to normal I will try to see if I can update it without reinstalling the module.

Production build 0.69.0 2024