Problem/Motivation

The table xray_audit_entity_host, introduced in #3623607, is created without a primary key. With the recommended transaction isolation level (READ COMMITTED), the status report shows:

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

Steps to reproduce

  1. Enable xray_audit and open the field usage report.
  2. Check the status report.

Proposed resolution

  • Add a serial id column as primary key.
  • Add an update hook that drops the table, so it is created again with the new schema when needed.
  • Add a kernel test.

Remaining tasks

Review.

User interface changes

API changes

Data model changes

New id primary key column in xray_audit_entity_host.

Issue fork xray_audit-3628792

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

juanjol created an issue. See original summary.

juanjol’s picture

Status: Active » Needs review

The composer job fails uploading artifacts (413 Request Entity Too Large), so the rest of the pipeline is skipped. This is not related to the MR.

Kernel tests run locally (Drupal 11, PHP 8.3) on SQLite and MySQL:

Entity Host Map (Drupal\Tests\xray_audit\Kernel\Services\EntityHostMap)
 ✔ Applies to
 ✔ Paragraph is mapped to its host
 ✔ Paragraph of previous revision is not mapped
 ✔ Nested paragraph is mapped to the node
 ✔ Deeply nested paragraphs are mapped
 ✔ Nested paragraph of detached branch is not mapped
 ✔ Orphan paragraph is not mapped
 ✔ Get host
 ✔ Table has primary key

Also tested on a real site: after drush updb the table is dropped, it is created again with the primary key the next time it is needed, and the status report error is gone.

juanjol’s picture

The CI/CD problems, not related to this change, are fixed in #3628804.

Running the pipeline manually with _COMPOSER_YARN_INSTALL=0 passes: https://git.drupalcode.org/issue/xray_audit-3628792/-/pipelines/991130

lpeidro made their first commit to this issue’s fork.

lpeidro’s picture

Status: Needs review » Fixed

I merge the MR.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.