statistics.install 1.25 KB
Newer Older
1
<?php
2
// $Id$
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

function statistics_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {accesslog} (
        aid int(10) NOT NULL auto_increment,
        sid varchar(32) NOT NULL default '',
        title varchar(255) default NULL,
        path varchar(255) default NULL,
        url varchar(255) default NULL,
        hostname varchar(128) default NULL,
        uid int(10) unsigned default '0',
        timer int(10) unsigned NOT NULL default '0',
        timestamp int(11) unsigned NOT NULL default '0',
        KEY accesslog_timestamp (timestamp),
        PRIMARY KEY (aid)
      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
21 22 23 24 25 26 27 28 29
      break;
    case 'pgsql':
      db_query("CREATE TABLE {accesslog} (
        aid serial,
        sid varchar(32) NOT NULL default '',
        title varchar(255) default NULL,
        path varchar(255) default NULL,
        url varchar(255) default NULL,
        hostname varchar(128) default NULL,
30 31 32
        uid int_unsigned default '0',
        timer int_unsigned NOT NULL default '0',
        timestamp int_unsigned NOT NULL default '0',
33 34 35 36
        PRIMARY KEY (aid)
      )");
      db_query("CREATE INDEX {accesslog}_accesslog_timestamp_idx ON {accesslog} (timestamp)");
      break;
37
  }
38
}