You are here

function ua_logger_schema in User Agent Logger 6

Same name and namespace in other branches
  1. 7 ua_logger.install \ua_logger_schema()

Implementation of hook_install(). OLD CODE FOR REFERENCE PURPOSES function ua_logger_install() { switch ($GLOBALS['db_type']) { case 'pgsql': db_query("CREATE TABLE {ua_logger} ( id SERIAL, xid integer default NULL, type text not null default null check (type in ('node', 'comment')) , ua text default NULL, PRIMARY KEY (id) )"); break; case 'mysql': case 'mysqli': db_query("CREATE TABLE {ua_logger} ( id int(10) unsigned zerofill NOT NULL auto_increment, xid int(10) unsigned zerofill default NULL, type enum('node','comment') default NULL, ua char(150) default NULL, PRIMARY KEY (id) ) ENGINE=MyISAM DEFAULT CHARSET=latin1"); break; } }

File

./ua_logger.install, line 31

Code

function ua_logger_schema() {
  $schema['ua_logger'] = array(
    'description' => t('...??'),
    'fields' => array(
      'id' => array(
        'type' => 'serial',
      ),
      'xid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
      ),
      'type' => array(
        'type' => 'varchar',
        'length' => 16,
      ),
      'ua' => array(
        'type' => 'varchar',
        'length' => 150,
      ),
    ),
    'primary key' => array(
      'id',
    ),
  );
  return $schema;
}