drop table if exists log_extras;
drop table if exists logs;

create table logs (
  id int(10) auto_increment not null,
  message text not null,
  level varchar(8) not null,
  category varchar(32) not null,
  created timestamp not null,
  primary key(id)
) ENGINE=InnoDB;

create table log_extras (
  log_id int(10) not null,
  name varchar(32) not null,
  value text not null,
  foreign key(log_id)
    references logs(id)
      on update cascade
      on delete cascade,
  primary key(log_id, name)
) ENGINE=InnoDB;
