CREATE TABLE mutation
(
  id    BIGINT       NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (id),
  chrom VARCHAR(255) NOT NULL,
  start INT          NOT NULL,
  end   INT          NULL,
  ref   VARCHAR(255) NULL,
  alt   VARCHAR(255) NULL
)
  ENGINE = InnoDB;

CREATE TABLE exome_seq_result
(
  type              VARCHAR(31)  NOT NULL,
  id                BIGINT       NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (id),
  amino_acid_change VARCHAR(255) NULL,
  consequence       VARCHAR(255) NULL,
  dna_vaf           FLOAT        NULL,
  filter            VARCHAR(255) NULL,
  sample_id         BIGINT       NOT NULL,
  mutation_id       BIGINT       NULL,
  gene_id           BIGINT       NULL,
  CONSTRAINT exome_seq_result_FK_mutation
  FOREIGN KEY (mutation_id) REFERENCES mutation (id),
  CONSTRAINT exome_seq_result_FK_sample
  FOREIGN KEY (sample_id) REFERENCES sample (id),
  CONSTRAINT exome_seq_result_FK_gene
  FOREIGN KEY (gene_id) REFERENCES gene (id)
)
  ENGINE = InnoDB;

CREATE INDEX exome_seq_result_INDEX_sample
  ON exome_seq_result (sample_id);

CREATE INDEX exome_seq_result_INDEX_gene
  ON exome_seq_result (gene_id);

CREATE INDEX exome_seq_result_INDEX_mutation
  ON exome_seq_result (mutation_id);

