You are here

function flag_views_bookmark_update_1 in Flag 6

Same name and namespace in other branches
  1. 5 includes/flag.views_bookmark.inc \flag_views_bookmark_update_1()
  2. 6.2 includes/flag.views_bookmark.inc \flag_views_bookmark_update_1()

Replace keys with primary keys.

File

includes/flag.views_bookmark.inc, line 175
Upgrade code to migrate from Views bookmark to Flag module.

Code

function flag_views_bookmark_update_1() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $ret[] = update_sql('ALTER TABLE {views_bookmarks} DROP INDEX vbid');
      $ret[] = update_sql('ALTER TABLE {views_bookmarks} ADD PRIMARY KEY (vbid)');
      $ret[] = update_sql('ALTER TABLE {views_bookmark_nodes} DROP INDEX nid');
      $ret[] = update_sql('ALTER TABLE {views_bookmark_nodes} ADD PRIMARY KEY (vbid, uid, nid)');
      $ret[] = update_sql('ALTER TABLE {views_bookmark_nodetypes} ADD PRIMARY KEY (vbid, type)');
      break;
  }
  return $ret;
}