Error Code: 1215. Cannot add foreign key constraint
I'm not sure wher I am getting this issue, here are the two tables in question, any help would be much appreciated!
CREATE TABLE IF NOT EXISTS `PHL_db`.`Session` (
`year` INT NOT NULL,
`season` VARCHAR(50) NOT NULL,
`division` VARCHAR(25) NOT NULL,
PRIMARY KEY (`year`, `season`, `division`))
ENGINE = InnoDB;
CREATE TABLE IF NOT EXISTS `PHL_db`.`Team` (
`name` VARCHAR(100) NOT NULL DEFAULT 'Free Agent',
`Session_season` VARCHAR(50) NOT NULL,
`Session_year` INT NOT NULL,
`Session_division` VARCHAR(25) NOT NULL,
PRIMARY KEY (`name`, `Session_season`, `Session_year`, `Session_division`),
FOREIGN KEY (`Session_season` , `Session_year` , `Session_division`)
REFERENCES `PHL_db`.`Session` ( `year`, `season` , `division`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;