Drupal: Where's my CCK content get stored in db ?

kamal's picture

Wrote about internal CCK storage in my personal blog sometimes ago but looking through issues coming up recently in our issue tracker suggest that some of developers here still not sure where their CCK content are stored in the database. Briefly revising this topic to give some clue on where to look after when something goes wrong with our CCK related content.

Here it goes:-

  • Node is stored inside node table with a column nid and vid to uniquely identified the node. This should be obvious to everyone developing with Drupal.
  • When creating new content type, let say building, a new table named content_type_building is created. This table would contain columns nid and vid plus all defined fields for that content type in the form of field_<field_name>_value.
  • If field we added to that content type is a shared field, new table would be created (if not exist) named as content_field_<field_name> with 3 columns - nid, vid, field_<field_name>_value. This is where content for this field get stored.

So basically all your content would be stored in 2 (or 3) different tables depending whether your field is shared or not.