title: Mysql error # 1215
body: <p>I have been using mySQL to create a database but when I try to forward engineer my EER Diagram the database keeps sending me back the same error I have tried multiple fixes does anyone see what the problem is? The error code is 1215</p>
  
  <blockquote>
    <p>Executing SQL script in server<br>
    ERROR: Error 1215: Cannot add foreign key constraint</p>
  </blockquote>
  
  <p>SQL Code:</p>
  
  <pre><code>    -- -----------------------------------------------------
      -- Table `mydb`.`Employee`
      -- -----------------------------------------------------
      CREATE TABLE IF NOT EXISTS `mydb`.`Employee` (
        `EID` INT NOT NULL,
        `Fname` VARCHAR(45) NOT NULL,
        `Lname` VARCHAR(45) NOT NULL,
        `AddressID` INT NOT NULL,
        `PayLevel` FLOAT NOT NULL,
        `Jobtitle` VARCHAR(45) NOT NULL,
        `Date of Employment` DATE NOT NULL,
        PRIMARY KEY (`EID`),
        CONSTRAINT `fk_Employee_Store1`
          FOREIGN KEY (`EID`)
          REFERENCES `mydb`.`Store` (`EID`)
          ON DELETE NO ACTION
          ON UPDATE NO ACTION)
      ENGINE = InnoDB
  </code></pre>
  
  <p>SQL script execution finished: statements: 8 succeeded, 1 failed</p>
  
  <p>Fetching back view definitions in final form.
  Nothing to fetch</p>
  
  <p>This is the parent code, multiple times I have tried switching the relationships however employee9the top code) should be a child of Store.</p>
  
  <pre><code>    -- -----------------------------------------------------
  -- Table `mydb`.`Store`
  -- -----------------------------------------------------
  CREATE TABLE IF NOT EXISTS `mydb`.`Store` (
    `SID` INT NOT NULL,
    `StoreName` VARCHAR(45) NULL,
    `AddressID` INT NULL,
    `EID` INT NOT NULL,
    `CID` INT NULL,
    `MID` INT NULL,
    PRIMARY KEY (`SID`, `EID`),
    INDEX `fk_Store_Employee1_idx` (`EID` ASC),
    CONSTRAINT `fk_Store_Employee1`
      FOREIGN KEY (`EID`)
      REFERENCES `mydb`.`Employee` (`EID`)
      ON DELETE NO ACTION
      ON UPDATE NO ACTION)
  ENGINE = InnoDB;
  </code></pre>
  
  <p>Does anyone see the problem, Btw I have checked the type's multiple times they are equivalent.</p>