You are here

function feedapi_node_update_1 in FeedAPI 5

Same name and namespace in other branches
  1. 6 feedapi_node/feedapi_node.install \feedapi_node_update_1()

Fix columns indeces.

File

feedapi_node/feedapi_node.install, line 57

Code

function feedapi_node_update_1() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysqli':
    case 'mysql':
      $ret[] = update_sql("ALTER TABLE {feedapi_node_item} CHANGE fiid fiid INT( 10 ) UNSIGNED NOT NULL");
      $ret[] = update_sql("ALTER TABLE {feedapi_node_item} DROP PRIMARY KEY");
      $ret[] = update_sql("ALTER TABLE {feedapi_node_item} ADD PRIMARY KEY ( nid )");
      $ret[] = update_sql("ALTER TABLE {feedapi_node_item} ADD INDEX ( feed_nid )");
      $ret[] = update_sql("ALTER TABLE {feedapi_node_item} ADD INDEX ( fiid )");
      $ret[] = update_sql("ALTER TABLE {feedapi_node_item} ADD INDEX ( `url` ( 255 ) )");
      $ret[] = update_sql("ALTER TABLE {feedapi_node_item} ADD INDEX ( `guid` ( 255 ) )");
      $ret[] = update_sql("DELETE FROM {sequences} WHERE name = 'feedapi_node_item_fiid'");
      $ret[] = update_sql("INSERT INTO {sequences} (name, id) VALUES ('feedapi_node_item_fiid', (SELECT MAX(fiid) FROM {feedapi_node_item}) )");
      break;
    case 'pgsql':
      $ret[] = update_sql("CREATE INDEX {fiid_index} on {feedapi_node_item}(fiid)");
      $ret[] = update_sql("CREATE INDEX {feed_nid_index} on {feedapi_node_item}(feed_nid)");
      $ret[] = update_sql("CREATE INDEX {url_index} on {feedapi_node_item}(url)");
      $ret[] = update_sql("CREATE INDEX {guid_index} on {feedapi_node_item}(guid)");
      break;
  }
  return $ret;
}