Search code examples
mysqlmysql-workbenchmysql-error-1005forward-engineer

Forward engineering EER diagram in MySQL Workbench


Using MySQL Workbench 5.2.33 with MySQL 5.1.41

I have created an EER diagram. But when I try to forward engineer it from MySQL Workbench, I get the following error:

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

Why am I getting this error?


Solution

  • http://forums.mysql.com/read.php?22,19755,298807#msg-298807

    You are not alone....