我正在尝试使用正向工程师从EER图创建数据库。我一直收到错误:
错误:错误1005:无法创建表
appdev
。order
(错误号码:150) "外键约束形成错误")
SQL代码:
-- -----------------------------------------------------
-- Table `appdev`.`Order`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `appdev`.`Order` (
`receiptno` INT NOT NULL,
`pono` INT NOT NULL,
`customer` VARCHAR(45) NULL,
PRIMARY KEY (`receiptno`, `pono`),
INDEX `fk_Order_Receipt1_idx` (`receiptno` ASC, `pono` ASC),
CONSTRAINT `fk_Order_Receipt1`
FOREIGN KEY (`receiptno` , `pono`)
REFERENCES `appdev`.`Receipt` (`receiptno` , `pono`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
SQL script execution finished: statements: 31 succeeded, 1 failed
Fetching back view definitions in final form.
Nothing to fetch