   ["CREATE TABLE IF NOT EXISTS `probes` (
    `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    `eid` INT NOT NULL,
-   FOREIGN KEY (eid) REFERENCES `experiments` (`id`),
-   `name` VARCHAR(255))"
-   "ALTER TABLE `probes` ADD CONSTRAINT IF NOT EXISTS `eid_name` UNIQUE(`eid`, `name`)"
-   "CREATE INDEX IF NOT EXISTS probe_name ON probes (eid, name)"])
+   `name` VARCHAR(255),
+   UNIQUE(`eid`, `name`),
+   FOREIGN KEY (`eid`) REFERENCES `experiments` (`id`))"])
 
 (def scores-table
   [(format "CREATE TABLE IF NOT EXISTS `scores` (

  ["CREATE TABLE IF NOT EXISTS `probemap_probes` (
   `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
   `probemaps_id` INT NOT NULL,
   FOREIGN KEY (probemaps_id) REFERENCES `probemaps` (`id`) ON DELETE CASCADE,
   `probe` VARCHAR(1000) NOT NULL)"])

; XXX CASCADE might perform badly. Might need to do this incrementally in application code.
(def probemap-positions-table
  ["CREATE TABLE IF NOT EXISTS `probemap_positions` (
   `probemaps_id` INT NOT NULL,
   FOREIGN KEY (`probemaps_id`) REFERENCES `probemaps` (`id`) ON DELETE CASCADE,
   `probemap_probes_id` INT NOT NULL,
   FOREIGN KEY (`probemap_probes_id`) REFERENCES `probemap_probes` (`id`) ON DELETE CASCADE,
   `bin` INT,
   `chrom` VARCHAR(255) NOT NULL,
   `chromStart` INT NOT NULL,
   `chromEnd` INT NOT NULL,
   `strand` CHAR(1))"
   "CREATE INDEX IF NOT EXISTS chrom_bin ON probemap_positions
   (`probemaps_id`, `chrom`, `bin`)"])

(def probemap-genes-table
  ["CREATE TABLE IF NOT EXISTS `probemap_genes` (
   `probemaps_id` INT NOT NULL,
   FOREIGN KEY (`probemaps_id`) REFERENCES `probemaps` (`id`) ON DELETE CASCADE,
   `probemap_probes_id` INT NOT NULL,
   FOREIGN KEY (`probemap_probes_id`) REFERENCES `probemap_probes` (`id`) ON DELETE CASCADE,
   `gene` VARCHAR(255))"
   "CREATE INDEX IF NOT EXISTS gene ON probemap_genes
   (`probemaps_id`, `gene`)"])

;
; feature tables

  ["CREATE TABLE IF NOT EXISTS `joins` (
   `pid` INT,
   `i` INT,
   `sid` INT,
   UNIQUE (`pid`, `i`))"])

(def cohorts-table
  ["CREATE TABLE IF NOT EXISTS `cohorts` (
   `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
   `name` VARCHAR(2000) NOT NULL UNIQUE)"])

; XXX What should max file name length be?
; XXX Unique columns? Indexes?
(def sources-table
  ["CREATE TABLE IF NOT EXISTS `sources` (
   `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
