You are here

function feedapi_node_update_3 in FeedAPI 5

Create and populate feed_nid / feed_item_nid table.

File

feedapi_node/feedapi_node.install, line 108

Code

function feedapi_node_update_3() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysqli':
    case 'mysql':
      $ret[] = update_sql("CREATE TABLE IF NOT EXISTS {feedapi_node_item_feed} (\n        `feed_nid` int(10) unsigned NOT NULL default '0',\n        `feed_item_nid` int(10) unsigned NOT NULL default '0',\n        PRIMARY KEY  (`feed_nid`,`feed_item_nid`),\n        KEY `feed_nid` (`feed_nid`),\n        KEY `feed_item_nid` (`feed_item_nid`)\n        ) DEFAULT CHARSET=latin1;\n      ");
      $ret[] = update_sql("REPLACE INTO {feedapi_node_item_feed} (feed_nid, feed_item_nid) SELECT feed_nid, nid FROM {feedapi_node_item}");
      $ret[] = update_sql("ALTER TABLE {feedapi_node_item} DROP `feed_nid`");
      break;
    case 'pgsql':
      $ret[] = update_sql("CREATE TABLE {feedapi_node_item_feed} (\n        feed_nid integer NOT NULL default '0',\n        feed_item_nid integer NOT NULL default '0',\n        PRIMARY KEY  (feed_nid,feed_item_nid))\n      ");
      $ret[] = update_sql("CREATE INDEX feed_item_nid_index on {feedapi_node_item_feed}(feed_item_nid)");
      $ret[] = update_sql("INSERT INTO {feedapi_node_item_feed} (feed_nid, feed_item_nid) SELECT feed_nid, nid FROM {feedapi_node_item}");
      $ret[] = update_sql("ALTER TABLE {feedapi_node_item} DROP feed_nid");
      break;
  }
  return $ret;
}