Drupal CCK - concepts and database tables

What follows is a brief summary of a nice (but verbose) introduction to the Drupal CCK module, which can be found at What is the Content Construction Kit? A View from the Database:

  • CCK allows the site administrator to define custom content types (aka node types) and fields. Content types define data structures and furthermore contain user input/validation rules needed to generate UI forms for populating those structures. Content types are like 'tables' or 'relations' within a relational database, while fields are like 'attributes'.
  • For each user-defined content type, CCK adds a table named content_type_type name
  • Different field types correspond to different data types. In particular, a node reference type is available for implementing 'foreign keys'.
  • For each field, CCK stores type-specific metadata in tables node_field (global data for each field, e.g. storage details) and node_field_instance (content type specific, e.g. contextual presentation details). The same field may be reused by multiple content types.
  • For fields of type 'single' (1:1 association between nodes and field values) that are not shared between content types, CCK stores field values and in columns field_field name_value of the respective content type table. Additional columns may also be stored there for the field (e.g. field format).
  • For fields of type 'multiple' (1:n association between nodes and field values) or shared between content types, CCK adds a table named content_field_field name

No comments:

Post a Comment