1

I am looking at my Drupal 7 database, and I think that I see the following pattern:

  • Fields that are defined programmatically are stored in tables named field_data_fieldname
  • Fields that are defined via the UI are named field_data_field_fieldname.

I don't find this convention documented anywhere. Did I take it right?

1
  • Any field created with the core Field UI module has its name prefixed with field_.
  • Any field created programmatically is named exactly as the module creating it wishes, without the prefix.
  • The field data tables are named directly from the field names

Yes, you have it absolutely right.

It's worth noting that the data is also stored in field_revision_foo, regardless of whether you're using revisions or not. The field_data_foo tables will always contain the most up-to-date data whether revisions are enabled or not.

0

The table name is always field_data_<machine_name_of_the_field>.

It just happens that the Field UI module adds field_ as part of the machine name, which is derived from the field name entered in the UI. So, if you create a Birthday field, the Field UI module will use field_birthday as machine name of the field, and Drupal will use field_data_field_birthday as database table name.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.