MySQL Workbench中的正向工程EER图

时间:2011-03-24 10:44:17

标签: mysql mysql-workbench mysql-error-1005 forward-engineer

将MySQL Workbench 5.2.33与MySQL 5.1.41一起使用

我已经创建了一个EER图。但是当我尝试从MySQL Workbench转发工程时,我收到以下错误:

Executing SQL script in server
ERROR: Error 1005: Can't create table 'test_db.test_table' (errno: 150)

-- ------------------------------------------------------- 
Table `test_db`.`test_table`
-- -------------------------------------------------------
CREATE  TABLE IF NOT EXISTS `test_db`.`test_table` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT ,
  `figure` TINYINT UNSIGNED NULL ,
  `users_id` BIGINT UNSIGNED NOT NULL ,
  `inactive` TINYINT(1)  NULL ,
  `type_id` TINYINT NOT NULL ,
  PRIMARY KEY (`id`, `users_id`, `type_id`) ,
  UNIQUE INDEX `id_UNIQUE` (`id` ASC) ,
  INDEX `fk_figure_users1` (`users_id` ASC) ,
  INDEX `fk_figure_type1` (`figure_type_id` ASC) ,
  CONSTRAINT `fk_figure_users1`
    FOREIGN KEY (`users_id` )
    REFERENCES `test_db`.`users` (`id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_figure_type1`
    FOREIGN KEY (`type_id` )
    REFERENCES `test_db`.`type` (`id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB

SQL script execution finished: statements: 9 succeeded, 1 failed

为什么我收到此错误?

1 个答案:

答案 0 :(得分:2)