You are here

function radioactivity_node_install in Radioactivity 5

Same name and namespace in other branches
  1. 6 plugins/radioactivity_node.install \radioactivity_node_install()

File

plugins/radioactivity_node.install, line 4

Code

function radioactivity_node_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {radioactivity_node_clicks} (\n                 nid int NOT NULL,\n                 uid int NOT NULL,\n                 remote_address VARCHAR(31) NOT NULL,\n                 click_timestamp int NOT NULL\n        ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
      db_query("CREATE INDEX {radioactivity_node_clicks_ix_nid_uid}\n                 ON {radioactivity_node_clicks} (nid, uid);");
      db_query("CREATE INDEX {radioactivity_node_clicks_ix_nid_ip}\n                 ON {radioactivity_node_clicks} (nid, remote_address);");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {radioactivity_node_clicks} (\n                 nid int NOT NULL,\n                 uid int NOT NULL,\n                 remote_address VARCHAR(31) NOT NULL,\n                 click_timestamp int NOT NULL\n        );");
      db_query("CREATE INDEX {radioactivity_node_clicks}_ix_nid_uid\n                 ON {radioactivity_node_clicks} (nid, uid);");
      db_query("CREATE INDEX {radioactivity_node_clicks}_ix_nid_ip\n                 ON {radioactivity_node_clicks} (nid, remote_address);");
      break;
  }
}