You are here

function feedapi_node_install in FeedAPI 5

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

File

feedapi_node/feedapi_node.install, line 4

Code

function feedapi_node_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysqli':
    case 'mysql':
      db_query("CREATE TABLE {feedapi_node_item} (\n        nid int(10) unsigned NOT NULL,\n        url text character set latin1 collate latin1_general_ci NOT NULL,\n        `timestamp` int(10) unsigned NOT NULL default '0',\n        arrived int(10) unsigned NOT NULL default '0',\n        guid text character set latin1 collate latin1_general_ci NOT NULL,\n        PRIMARY KEY  (nid),\n        KEY arrived (arrived),\n        KEY url (url(255)),\n        KEY guid (guid(255))\n        ) DEFAULT CHARSET=latin1;\n      ");
      db_query("CREATE TABLE {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      ");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {feedapi_node_item} (\n        nid integer not null,\n        url text NOT NULL default '',\n        timestamp integer not null,\n        arrived integer not null,\n        guid text NOT NULL default '',\n        PRIMARY KEY(nid))\n      ");
      db_query("CREATE INDEX {feedapi_node_item}_arrived_idx ON {feedapi_node_item} (arrived)");
      db_query("CREATE INDEX url_index on {feedapi_node_item}(url)");
      db_query("CREATE INDEX guid_index on {feedapi_node_item}(guid)");
      db_query("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      ");
      db_query("CREATE INDEX feed_nid_index on {feedapi_node_item_feed}(feed_nid)");
      db_query("CREATE INDEX feed_item_nid_index on {feedapi_node_item_feed}(feed_item_nid)");
      break;
  }

  // Add the node type.
  _feedapi_node_install_type_create();
}