   ["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` (

   :defaults features-defaults
   :columns features-columns})

(def codes-table
  ["CREATE TABLE IF NOT EXISTS `codes` (
  `id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `features_id` int(11) NOT NULL,
   FOREIGN KEY (`features_id`) REFERENCES `features` (`id`) ON DELETE CASCADE,
   `ordering` int(10) unsigned NOT NULL,
   `value` varchar(255) NOT NULL)"
   "CREATE INDEX IF NOT EXISTS `feature` ON `codes` (`features_id`, `ordering`)"])

(defentity codes
  (belongs-to features))

  ["CREATE TABLE IF NOT EXISTS `features` (
  `id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `probes_id` int(11) NOT NULL,
  `shortTitle` varchar(255),
  `longTitle` varchar(255),
  `priority` double DEFAULT NULL,
  `valueType` varchar(255) NOT NULL,
  `visibility` varchar(255),
  FOREIGN KEY (`probes_id`) REFERENCES `probes` (`id`) ON DELETE CASCADE)"])

(declare codes)
(defentity features
