API page: https://api.drupal.org/api/drupal/core%21modules%21user%21user.install/f...

The description given for the uid field in the user_data table is the following.

'description' => 'Primary key: {users}.uid for user.'

It is not the primary key, since that is the following.

'primary key' => ['uid', 'module', 'name']

It should be described similarly to how nid is described for the node_access table. (See https://api.drupal.org/api/drupal/core%21modules%21node%21node.install/f....)

'description' => 'The {node}.nid this record affects.'
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kiamlaluno created an issue. See original summary.

apaderno’s picture

Status: Active » Needs review
FileSize
548 bytes

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

apaderno’s picture

Component: documentation » user.module
Category: Bug report » Task
FileSize
548 bytes

I am not sure it is correct to use Documentation as component, since this is a change in code, even it is a literal string.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

benjifisher’s picture

Status: Needs review » Reviewed & tested by the community
Related issues: +#2883260: Replace the schema example with one actually used from a module

@kiamlaluno:

It looks as though the patches in #2 and #4 are identical. Is that on purpose? You do not need to re-upload the patch just because you are changing the issue metadata.

-        'description' => 'Primary key: {users}.uid for user.',
+        'description' => 'The {users}.uid this record affects.',

I am not sure that is a lot clearer.

I guess the intention of the the original version is that this is the primary key of the {users} table, not that it is the primary key of the {users_data} table.

As you point out, your proposed description is consistent with the corresponding description in the {node_access} table. I guess that is a good enough reason, so I will mark this issue RTBC.

I am adding #2883260: Replace the schema example with one actually used from a module as a related issue. The current patch on that issue uses the {users_data} table as the source of the example in database.api.php. If either of these issues is accepted, then the other should be updated to keep the two consistent.

apaderno’s picture

@benjifisher I added the patch for the new Drupal version.

'Primary key: {users}.uid for user.' is confusing because it makes think that is the primary key for the table being described, which is not true. I took the descriptions for the {node_access} table as example; I thought they described better the table and the fields.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed 7ecfaf4 and pushed to 8.7.x. Thanks!

  • catch committed 7ecfaf4 on 8.7.x
    Issue #2886740 by kiamlaluno: user_schema() reports uid as primary key...

Status: Fixed » Closed (fixed)

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