Closed (fixed)
Project:
Drupal core
Version:
8.7.x-dev
Component:
user.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
4 Nov 2018 at 03:36 UTC
Updated:
22 Nov 2018 at 14:09 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
benjifisherThe current patch on #2883260: Replace the schema example with one actually used from a module uses the
{users_data}table as the example indatabase.api.php, which is the source of the Schema API documentation. I am recommending a similar change there.Comment #3
avpadernoComment #4
avpadernoComment #5
avpadernoComment #6
benjifisher@kiamlaluno:
Thanks for looking at this, and for updating the issue title!
I know that @alexpott, in [#2883260.11], says to keep that comment in the sample code in database.api.php, but I still think it is redundant. In this context, I can also argue for consistency: none of the other core modules have such a comment in their code.
I guess that the key can be anything, but why "data_owner"? Do you mean that this is the
users_datatable, and this key identifies the user that "owns" the data in this table?Looking at the other core modules,
foreign_keysarray; here, that would beusers. I do not like that much.set_user, so maybedata_userwould follow the same pattern.sessionstable in the System module usessession_user.node_accesstable usesaffected_node, soaffected_userwould follow that pattern.I suggest
data_useroraffected_user, but you can leave it asdata_ownerif you think that is clearest.Comment #7
avpadernoaffected_node makes sense for the node access table, but for the user_data table I see preferable the pattern used for the sessions table.
I left the comment because it was already present in the example given for the schema API. It probably doesn't make sense to repeat it for the module, where it doesn't have the purpose of "teaching" about the foreign keys being used only for documentation.
Comment #8
benjifisher@kiamlaluno:
Thanks for the update. This looks good to me.
Comment #9
avpaderno@benjifisher Thank you for the suggestions.
Comment #10
catchCommitted 125e9f4 and pushed to 8.7.x. Thanks!