Last updated March 24, 2015. Created on September 16, 2012.
Edited by rpayanm, ursula, tormi, Sahin. Log in to edit this page.

Drupal 5

...

Drupal 6

...

Drupal 7

See Database API for a detailed documentation. For a quick reference, the following Drupal 7 database entity relationship diagram might be helpful:
db_schema_drupal_7 Credits: http://upsitesweb.com/blog/2011/06/drupal-7-database-schema.

Drupal 8

Detailed information is available at the Drupal 8 Database API page. For a quick reference, see the Drupal 8 database E/R diagram below (Drupal 8 from 10/19/2013):D8 Database Schema

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

Comments

ssoulless’s picture

I have a question, in the D7 entity relation ship diagram, there is a relation between users and comments but that relation is one-to-one

why? if an user can have from 1 to many comments, that is confusing me a little bit. If someone can ask my question would be appreciated.

And also how is the fields connected with the nodes? I cannot see the connection of fields and nodes or node types, souldn't exist a relation one-to-many between the node type and fields?

Srry if my questions are stupid Im just still learning

bart atlas’s picture

Hi ssoulless, it's a good question. I notice that other relationships are not according to usage in Drupal, for example the diagram (D7) shows many users involved in one users_roles record (crowsfeet on users table) and many roles involved in one users_roles record.

I believe the correct way to show those relationships would be to have crowsfeet on the users_roles and double bar on the users table end; and crowsfeet from users_roles to double bar on roles table. One user can have multiple user-roles and one role can participate in multiple users-roles.

This page has some good info and better diagrams, also a downloadable MySQL model to play with:
http://posulliv.github.io/2012/08/02/drupal-er-diagram/

I realize this reply is late, but hopefully it will be helpful to others.

ClemensM’s picture

The one from posulliv.github.io is in fact more thoroughly and fixes that mistake.

However, I still don't unterstand why it is a "only one ←→ one or more" relation? Isn't it in real a "only one ←→ zero or more" relation??
Since after all a user CAN ALSO HAVE made zero comments.

Same is the case for '[node]←→[comment]' and would guess some more (...in fact both diagrams show no "zero or more" symbol at all :o)

( if it would be '[person]←→[birth place]' the "1/more" would be the right connection, beause a person MUST have been born somewhere )

Who can solve this confusion?

yogeshchaugule8’s picture

Is there any documentation available regarding detailed database structure in Drupal8. I'm looking for details on which table is used for storing what details. Many tables are easy enough to understand what they store, except key_value, and key_value_expire. It would be good if we can have something like "Drupal 7 core tables" for Drupal 8 tables as well.