You are here

function follow_update_6000 in Follow 6

Update for caching and schema changes.

File

./follow.install, line 91
Follow module's install and uninstall code.

Code

function follow_update_6000() {
  $ret = array();
  if (drupal_get_installed_schema_version('follow') == 5000) {
    drupal_set_installed_schema_version('follow', 6003);
    return $ret;
  }

  // We no longer cache the follow networks.
  cache_clear_all('follow:networks', 'cache');
  $schema = follow_schema();
  $path = $schema['follow_links']['fields']['path'];
  $options = $schema['follow_links']['fields']['options'];

  // Since we match against just uid in queries, this field must
  // come first for the index to be used.
  db_drop_unique_key($ret, 'follow_links', 'name_uid');
  db_add_unique_key($ret, 'follow_links', 'uid_name', array(
    'uid',
    'name',
  ));
  db_add_field($ret, 'follow_links', 'path', $path);
  db_add_field($ret, 'follow_links', 'options', $options);

  // We need to populate current rows' options col with an empty array.
  $ret[] = update_sql("UPDATE {follow_links} SET options = 'a:0:{}'");
  return $ret;
}