You are here

radioactivity_arbitrary_target.install in Radioactivity 5

File

plugins/radioactivity_arbitrary_target.install
View source
<?php

function radioactivity_arbitrary_target_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {radioactivity_arbitrary_target} (\n                  `rad_id` int(11) NOT NULL,\n                  `arb_id` varchar(255) NOT NULL,\n                  PRIMARY KEY  (`rad_id`,`arb_id`)\n        ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {radioactivity_arbitrary_target} (\n                  rad_id int NOT NULL,\n                  arb_id varchar(255) NOT NULL,\n                  PRIMARY KEY  (rad_id, arb_id)\n        )");
      db_query("CREATE SEQUENCE {radioactivity_arbitrary_target}_rad_id_seq");
      break;
  }
}
function radioactivity_arbitrary_target_uninstall() {
  db_query("DROP TABLE {radioactivity_arbitrary_target}");
  if (db_table_exists('radioactivity')) {
    db_query("DELETE FROM {radioactivity} WHERE class='arb'");
  }
  switch ($GLOBALS['db_type']) {
    case 'pgsql':
      db_query("DROP SEQUENCE {radioactivity_arbitrary_target}_rad_id_seq");
      break;
  }
}