You are here

counter.install in Counter 5

File

counter.install
View source
<?php

function counter_install() {
  drupal_set_message('Installing Counter module');
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {counter} (\n                `counter_id`   int         NOT NULL auto_increment,\n                `counter_ip`   varchar(32) NOT NULL default '',\n                `counter_date` varchar(32) NOT NULL default '',\n                `counter_page` varchar(32) NOT NULL default '0',\n                 PRIMARY KEY (counter_id)\n              ) /*!40100 DEFAULT CHARACTER SET utf8 */");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {counter} (\n                counter_id   serial CHECK (nid >= 0),\n                counter_ip   varchar(32) NOT NULL default '',\n                counter_date varchar(32) NOT NULL default '',\n                counter_page varchar(32) NOT NULL default '0',\n                PRIMARY KEY (counter_id)\n      )");
      break;
  }
}
function counter_uninstall() {
  db_query('DROP TABLE {counter}');
}

Functions