use island42;
drop table if exists log_stats;

create table log_stats (
  id int(11) NOT NULL primary key auto_increment,
  day date NOT NULL,
  log_type_id int(11) NOT NULL default '1',
  one_per_ip_per_day char(1) not null default 'f',
  affiliate_user_id int(11) null,
  campaign_id int(11) null,
  total int(11) not null,
  unique (day, log_type_id, one_per_ip_per_day, affiliate_user_id, campaign_id)
) type=InnoDB;

create index log_stats_i1 on island42.log_stats(day);
create index log_stats_i2 on island42.log_stats(log_type_id);
create index log_stats_i3 on island42.log_stats(affiliate_user_id);
create index log_stats_i4 on island42.log_stats(campaign_id);