use island42;
drop table if exists log;

create table log (
  id int(11) NOT NULL primary key auto_increment,
  ts timestamp NOT NULL default now(),
  log_type_id int(11) NOT NULL default '1',

  request_uri varchar(255) NOT NULL default '',
  referring_url varchar(255) NOT NULL default '',
  affiliate_user_id int(11) null,
  campaign_id int(11) null,
  user_id int(11) null,
  session_code varchar(30) null,
  ip varchar(14) not null default '',
  hostname varchar(50) not null default '',
  comment text not null default '',
  ms int(11) not null
) type=InnoDB;

create index log_i1 on island42.log(ts);
create index log_i2 on island42.log(log_type_id);
create index log_i3 on island42.log(user_id);
create index log_i4 on island42.log(affiliate_user_id);
create index log_i5 on island42.log(campaign_id);
create index log_i6 on island42.log(session_code);