You are here

function noderelationships_schema in Node Relationships 6

Implementation of hook_schema().

File

./noderelationships.install, line 73
Implementation of installation/uninstallation hooks.

Code

function noderelationships_schema() {
  $schema = array();
  $schema['noderelationships_settings'] = array(
    'description' => 'Stores relationship settings.',
    'fields' => array(
      'type_name' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Name of the base content type.',
      ),
      'relation_type' => array(
        'type' => 'varchar',
        'length' => 10,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Relation type: noderef or backref.',
      ),
      'related_type' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Name of the related content type.',
      ),
      'field_name' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Name of the related nodereference field.',
      ),
      'settings' => array(
        'type' => 'text',
        'size' => 'medium',
        'not null' => TRUE,
        'description' => 'Relation settings (serialized).',
      ),
    ),
    'primary key' => array(
      'type_name',
      'relation_type',
      'related_type',
      'field_name',
    ),
    'indexes' => array(
      'type_field_relation' => array(
        'type_name',
        'field_name',
        'relation_type',
      ),
      'related_field_relation' => array(
        'related_type',
        'field_name',
        'relation_type',
      ),
      'field_name' => array(
        'field_name',
      ),
    ),
  );
  return $schema;
}