1
使用MySQL Workbench 5.2.33和MySQL 5.1.41MySQL Workbench中的正向工程EER圖
我已經創建了一個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
爲什麼我會收到此錯誤?
感謝您的鏈接。我有一個ID最初設置爲無符號,然後當使用該ID連接到另一個表時,它被設置爲有符號。修正了這個問題,它轉發很好! – oshirowanen 2011-03-24 11:29:54