
create table entity (
  id VARCHAR(128) unique not null,
  project VARCHAR(128),
  instruction_data mediumblob,
  fitness double,
  generation int,
  image mediumblob,
  votes bigint not null default 0,
  votes_up bigint not null default 0,
  primary key(id)
) type=innodb;

create unique index entity_id_idx on entity(id);

create index entity_fitness_idx on entity(project, fitness);

create index entity_votes_idx on entity(project, votes);
create index entity_votes_up_idx on entity(project, votes_up);


create table top (
  id VARCHAR(128) unique not null,
  project VARCHAR(128),
  instruction_data mediumblob,
  fitness double,
  generation int,
  image mediumblob,
  created_at timestamp,
  primary key(id)
) type=innodb;

create unique index top_id_idx on top(id);

create index top_fitness_idx on top(project, fitness);
create index top_added_idx on top(project, created_at);



