   CONSTRAINT `workerAnswered`
     FOREIGN KEY (`worker_id`)
     REFERENCES `crowdcontrol`.`Worker` (`id_worker`)
+    ON DELETE CASCADE
+    ON UPDATE CASCADE,
+  CONSTRAINT `reservation_answer`
+    FOREIGN KEY (`reservation`)
+    REFERENCES `crowdcontrol`.`Answer_Reservation` (`idAnswer_Reservation`)
     ON DELETE CASCADE
     ON UPDATE CASCADE)
 ENGINE = InnoDB

  `version` INT NOT NULL,
  `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`idDatabase_Version`))
ENGINE = InnoDB;

USE `crowdcontrol`;



-- -----------------------------------------------------
-- Table `crowdcontrol`.`Rating_Reservation`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `crowdcontrol`.`Rating_Reservation` (
  `idReserverd_Rating` INT NOT NULL,
  `worker` INT NOT NULL,
  `experiment` INT NOT NULL,
  `answer` INT NOT NULL,
  `timestamp` TIMESTAMP NOT NULL,
  PRIMARY KEY (`idReserverd_Rating`),
  INDEX `reserved_Answer_idx` (`answer` ASC),
  INDEX `worker_will_rate_idx` (`worker` ASC),
  INDEX `experiment_will_rated_on_idx` (`experiment` ASC),
  CONSTRAINT `reserved_Answer`
    FOREIGN KEY (`answer`)
    REFERENCES `crowdcontrol`.`Answer` (`id_answer`)
    ON DELETE RESTRICT
    ON UPDATE RESTRICT,
  CONSTRAINT `worker_will_rate`
    FOREIGN KEY (`worker`)
    REFERENCES `crowdcontrol`.`Worker` (`id_worker`)
    ON DELETE CASCADE
    ON UPDATE CASCADE,
  CONSTRAINT `experiment_will_rated_on`
    FOREIGN KEY (`experiment`)
    REFERENCES `crowdcontrol`.`Experiment` (`id_experiment`)
    ON DELETE CASCADE
    ON UPDATE CASCADE)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `crowdcontrol`.`Rating`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `crowdcontrol`.`Rating` (
