You are here

function search_by_page_update_7001 in Search by Page 7

Add role index to {sbp_path}, and new database table for indexing users.

File

./search_by_page.install, line 254
Install hooks for search_by_page module

Code

function search_by_page_update_7001() {

  // This update function only needs to be run if it wasn't previously
  // done in Drupal 6 updates. To figure that out, test for existence
  // of the 'sbp_index_users' table.
  if (db_table_exists('sbp_index_users')) {

    // This exact update function was run in Drupal 6, so skip.
    return;
  }
  db_add_index('sbp_path', 'role', array(
    'role',
  ));
  $newtable = array(
    'description' => 'Users to be used for search indexing',
    'fields' => array(
      'rid' => array(
        'description' => 'Role ID',
        'type' => 'int',
        'size' => 'big',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'uid' => array(
        'description' => 'User ID of user created for this role',
        'type' => 'int',
        'size' => 'big',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'rid',
    ),
  );
  db_create_table('sbp_index_users', $newtable);
}