You are here

function search_api_sorts_update_7202 in Search API sorts 7

Add an identifier field consisting of the index and field name.

File

./search_api_sorts.install, line 127
Install, update, and uninstall functions for the Search API sorts module.

Code

function search_api_sorts_update_7202() {
  db_add_field('search_api_sort', 'identifier', array(
    'description' => 'The identifier for this sort.',
    'type' => 'varchar',
    // This is ugly, but we can't be sure how long a field name might get.
    'length' => 255,
    'not null' => TRUE,
    'default' => '',
  ));
  db_update('search_api_sort')
    ->expression('identifier', 'CONCAT(index_id, \'__\', field)')
    ->execute();
}