You are here

function data_get_index_definition in Data 8

Same name and namespace in other branches
  1. 6 data.module \data_get_index_definition()
  2. 7 data.module \data_get_index_definition()

Get a Schema API index definition for a given field type. @todo: support multiple name/type combinations.

2 calls to data_get_index_definition()
Table::addIndex in src/Table.php
Add an index to table.
Table::addUniqueKey in src/Table.php
Add a unique key to a field.

File

./data.module, line 126
Hooks and API functions for data module.

Code

function data_get_index_definition($field_name, $spec) {

  // Default to 255 for now.
  if ($spec['type'] == 'text') {

    // @todo: what's the right format here? this is broken.
    return array(
      array(
        $field_name,
        255,
      ),
    );
  }
  else {
    return array(
      $field_name,
    );
  }
}