You are here

function field_reference_field_schema in Field reference 7

Implements hook_field_schema().

File

./field_reference.module, line 84
Defines a field type for referencing a field from another.

Code

function field_reference_field_schema($field) {
  $columns = array(
    'field_key' => array(
      'type' => 'varchar',
      'length' => 32,
      'not null' => FALSE,
    ),
    'entity_type' => array(
      'type' => 'varchar',
      'length' => 128,
      'not null' => FALSE,
    ),
    'entity_id' => array(
      'type' => 'int',
      'unsigned' => TRUE,
      'not null' => FALSE,
    ),
    'revision_id' => array(
      'type' => 'int',
      'unsigned' => TRUE,
      'not null' => FALSE,
    ),
    'language' => array(
      'type' => 'varchar',
      'length' => 32,
      'not null' => FALSE,
    ),
    'delta' => array(
      'type' => 'int',
      'unsigned' => TRUE,
      'not null' => FALSE,
    ),
  );
  return array(
    'columns' => $columns,
    'indexes' => array(
      'field_reference_field_key' => array(
        'field_key',
      ),
      'field_reference_entity_type' => array(
        'entity_type',
      ),
      'field_reference_entity_id' => array(
        'entity_id',
      ),
      'field_reference_revision_id' => array(
        'revision_id',
      ),
      'field_reference_language' => array(
        'language',
      ),
      'field_reference_delta' => array(
        'delta',
      ),
    ),
  );
}