如何使用表同步mysql EER图上的更改

时间:2012-10-22 14:42:25

标签: mysql database-design mysql-workbench eer-model

我在EER图中创建了我的关系,我想在桌子上看到foreing键。我读了this article

但是当我这样做时,会出现这样的错误:

    Executing SQL script in server

ERROR: Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(11) NOT NULL  AFTER `UserId` 

, DROP PRIMARY KEY 

, ADD PRIMARY KEY (`AddressId' at line 1





ALTER TABLE `kobiakinlar`.`address` ADD COLUMN `user_UserId` (11) NOT NULL  AFTER `UserId` 

, DROP PRIMARY KEY 

, ADD PRIMARY KEY (`AddressId`, `user_UserId`) 

, ADD INDEX `fk_address_user_idx` (`user_UserId` ASC) 



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

如何将表格与EER图表同步。

1 个答案:

答案 0 :(得分:0)

我注意到我需要将MySql存储引擎设置为InnoDB。正如您在MySQL WorkBench外键选项卡中看到的那样,服务器接受其他存储引擎的外键定义,但默认忽略它们。您可以在here.

中阅读有关存储引擎的信息