The custom `metis` table defined in metis.install has no primary key and no unique key on `code_public`.

Right now duplicate protection is handled only in application code during import. A database-level uniqueness constraint would make the module more robust and easier to maintain on current core.

Proposed change:

- Add a unique key for `code_public` in `hook_schema()`.
- Provide an update hook for existing installs.
- Decide how to handle pre-existing duplicate rows during the update path.

Suggested acceptance criteria:

- New installs create the table with a uniqueness constraint on `code_public`.
- Existing installs can update cleanly through update hooks.
- Duplicate code insertion is prevented at the database layer.

Issue fork metis-3511194

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

marcoka created an issue. See original summary.

sanduhrs’s picture

Version: 2.0.3 » 2.0.x-dev
Category: Task » Bug report
sanduhrs’s picture

Title: The following table(s) do not have a primary key: metis. » Add a unique database key for code_public and provide an update path

//edit: n7a

sanduhrs’s picture

Issue summary: View changes
sanduhrs’s picture

Issue tags: +D11 compatability

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

yan’s picture

Assigned: Unassigned » yan

  • yan committed 01dd7401 on 2.0.x
    Resolve #3511194: Add unique key to public Metis code and implement...
yan’s picture

Status: Active » Fixed

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.

yan’s picture

Status: Fixed » Needs work

Turns out Drupal requires a primary key, not only unique. With current code, status page shows an error message about READ-COMMITTED setting.

  • yan committed 27f30e57 on 2.0.x
    Resolve #3511194 "Add a unique database key for code_public"
    
yan’s picture

Status: Needs work » Fixed

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.

Status: Fixed » Closed (fixed)

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