MySQL Workbench - 如何同步 EER 图

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2410164/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 15:28:21  来源:igfitidea点击:

MySQL Workbench - How to synchronize the EER Diagram

mysqlmysql-workbencheer-model

提问by Tiago Alves

I am creating a visual representation of my existing database with MySQL Workbench and I am able to synchronize the models with the "Database -> Synchronize Model..." menu. However, every time I synchronize (update) my model, I have to recreate the EER Diagram and rearrange all the tables. Is there a way to update or synchronize the EER Diagram as well? Thanks.

我正在使用 MySQL Workbench 创建我现有数据库的可视化表示,并且我能够使用“数据库 - > 同步模型...”菜单同步模型。但是,每次同步(更新)我的模型时,我都必须重新创建 EER 图并重新排列所有表。有没有办法更新或同步 EER 图?谢谢。

回答by Jeff B

  • Database > Synchronize Model...
  • Choose Stored Connection
  • Select the Schemata
  • Choose which to update: Model or Source (in your case, point arrows to Model)
  • 数据库 > 同步模型...
  • 选择存储连接
  • 选择架构
  • 选择要更新的内容:模型或源(在您的情况下,将箭头指向模型)

回答by ingkebil

Are you by any chance using a MySQL DB engine that doesn't support foreign keys (e.g. MyISAM?)? Hence, the relations between the tables is not saved on the MySQL server and get lost during synchronization to the workbench.

您是否有机会使用不支持外键的 MySQL 数据库引擎(例如 MyISAM?)?因此,表之间的关系不会保存在 MySQL 服务器上,并且会在与工作台同步的过程中丢失。

But I realize this is only the 'why' of your question. I cannot provide an answer that would preserve your arrangement without using an engine that supports foreign keys, e.g. InnoDB.

但我意识到这只是你问题的“为什么”。如果不使用支持外键的引擎(例如 InnoDB),我无法提供可以保留您的安排的答案。

回答by Fran?ois Breton

When I have more than 3 tables to sync, with changes on relations, I changes arrow direction (model <- source), I check "Skip DB changes and update model only" and Execute...

当我有 3 个以上的表要同步时,随着关系的变化,我会更改箭头方向(模型 <- 源),我选中“仅跳过数据库更改并更新模型”并执行...

The "Progress of Model and Database Synchronization" window hangwith "Apply changes to Model" highlighted. No processor working, nothing move...

“模型和数据库同步进度”窗口挂起,并突出显示“将更改应用于模型”。没有处理器工作,没有任何动作......

I click the X of the window and redo the process again. Clicking the DB, ignore (all), and selecting less tables to update.

我单击窗口的 X 并再次重做该过程。单击数据库,忽略(全部),然后选择较少的表进行更新。

v.5.2.44 ce rev 9933

v.5.2.44 ce 修订版 9933

EDIT: Version 5.2.47 correct this bug !!! Yé !

编辑:版本 5.2.47 更正了这个错误!!!耶!

回答by Fran?ois Breton

I was having a variant of this problem--somehow when I would update the model from the database, one of my tables and its corresponding updatable view wouldn't update.

我遇到了这个问题的一个变体——不知何故,当我从数据库更新模型时,我的一个表及其相应的可更新视图不​​会更新。

I believe what was happening is that the modelwas actually updating, but not the diagram. I didn't really make the distinction at first.

我相信发生的事情是模型实际上正在更新,而不是图表。一开始我并没有真正区分。

Anyway here's how to get the refresh on the E/R diagram:

无论如何,这里是如何刷新 E/R 图:

  1. Delete the nonupdating object(s) from the diagram. (Just right click and choose "Delete".)
  2. Find the objects in the catalog view in the left sidebar.
  3. Drag them back onto the diagram.
  1. 从图中删除非更新对象。(只需右键单击并选择“删除”。)
  2. 在左侧边栏中的目录视图中查找对象。
  3. 将它们拖回到图表上。

Now they should reflect the model (which should reflect the DB if you followed the accepted answer above.)

现在它们应该反映模型(如果您遵循上面接受的答案,它应该反映数据库。)