Error messages when trying to create table with foreign key
I have created a db structure in Workbench for my record collection and have exported the 'create table' code. Here are the first 2 tables. The second table won't import - I'm getting an errno: 150 error. Can you tell me what's causing it?
Thanks
Charles
-- -----------------------------------------------------
-- Table `mydb`.`Release`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `Release` (
`idRelease` INT NOT NULL AUTO_INCREMENT ,
`Title` VARCHAR(45) NULL ,
`Artist` VARCHAR(45) NULL ,
`Format` VARCHAR(45) NULL ,
`Type` VARCHAR(45) NULL ,
`Issue` VARCHAR(45) NULL ,
`Country` VARCHAR(45) NULL ,
`Date` DATE NULL ,
`CatalogueNum` VARCHAR(45) NULL ,
`Company` VARCHAR(45) NULL ,
`Label` VARCHAR(45) NULL ,
`AudioFormat` VARCHAR(45) NULL ,
`Track` VARCHAR(45) NULL ,
`ChronologyNum` INT NULL ,
`LinerNotesBy` VARCHAR(45) NULL ,
`Notes` TEXT NULL ,
PRIMARY KEY (`idRelease`) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`Type`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `Type` (
`idType` INT NOT NULL AUTO_INCREMENT ,
`Type` VARCHAR(45) NULL ,
PRIMARY KEY (`idType`) ,
INDEX `fk_type` (`idType` ASC) ,
CONSTRAINT `fk_type`
FOREIGN KEY (`idType` )
REFERENCES `mydb`.`Release` (`Type` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;