7

I have a content type in drupal 8 and which table stores the content type fields and type in drupal 8 ? Unlike in drupal 6 (in which there will be tables specifically for content types) like content_type_contenttypename its not creating the table and fields . Where will be these fields and data types stored in drupal 8 ??

2 Answers 2

12

Drupal 8:

  • Content type = Bundle
  • Node = Entity

  • Base fields are in one table: [entity]_field_data

  • Bundle fields are in seperate tables: [entity]__field_name

Bundle fields are stored in the same table for all bundles of one entity and can be shared between bundles of the same entity but not with another entity.

5
  • I'm just trying to work out what that bundle column in the field tables is actually for, do you know? Given that entity IDs are unique, and a node can only have one bundle, I'm struggling to come up with anything that would make it useful. The description says it's used for when fields are deleted, but that doesn't make sense to me either...
    – Clive
    Jul 21, 2016 at 13:07
  • 3
    Bundle is an index key, so this is probably to find content faster. For example if you want to delete a bundle you would otherwise have to go through the complete table.
    – 4uk4
    Jul 21, 2016 at 13:10
  • Yep, that'll be it. Cheers
    – Clive
    Jul 21, 2016 at 13:12
  • I migrated from d6->d8 , so there are many tables starting migrate_map_d6_ and migrate_message_d6_ . Any idea about this ?
    – KTM
    Jul 21, 2016 at 13:21
  • No, never migrated from d6. Ask another question.
    – 4uk4
    Jul 21, 2016 at 13:27
2

Each field values will be stored in a separate table.

For field foo the table name will be node__foo

3
  • So there wont be any table specific to content types ? for each fields in a content type there will be as much tables ?
    – KTM
    Jul 21, 2016 at 13:02
  • Yes. This is the default behavior for bundle (content for for nodes) specific fields in drupal 8
    – Eyal
    Jul 21, 2016 at 13:18
  • @Icecreamsandwich IIRC, that changed in D7 when proper field support was introduced in core (rather than CCK). The D6 method of sometimes using the content type table for field data was fragile, and ended up with broken queries when things changes. This makes it more stable and predictable.
    – mpdonadio
    Jul 21, 2016 at 14:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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