You are here

function search_api_update_7118 in Search API 7

Adds the {search_api_item_string_id} table for items with string IDs.

File

./search_api.install, line 1082
Install, update and uninstall functions for the Search API module.

Code

function search_api_update_7118() {

  // Some users have reported that the table already existed for them, for
  // whatever reason. Therefore, just bail if the table already exists, assuming
  // it already looks as expected.
  if (db_table_exists('search_api_item_string_id')) {
    return;
  }
  $table = array(
    'description' => 'Stores the items which should be indexed for each index, and their status. Used only for items with string IDs.',
    'fields' => array(
      'item_id' => array(
        'description' => "The item's ID.",
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
      ),
      'index_id' => array(
        'description' => 'The {search_api_index}.id this item belongs to.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'changed' => array(
        'description' => 'Either a flag or a timestamp to indicate if or when the item was changed since it was last indexed.',
        'type' => 'int',
        'size' => 'big',
        'not null' => TRUE,
        'default' => 1,
      ),
    ),
    'indexes' => array(
      'indexing' => array(
        'index_id',
        'changed',
      ),
    ),
    'primary key' => array(
      'item_id',
      'index_id',
    ),
  );
  db_create_table('search_api_item_string_id', $table);
}