Reputation: 4521
I am using MySQL Workbench for creating an ER diagram but the problem I am facing is to create tables directly from the ER diagram. I have created an schema, as you can see in the below diagram. Can't I just directly import the same schema from here and start inserting the values in database
?
As you see in the figure below, the tables are already created as a part of ER diagram, but I don't understand why it is not showing in my database tab.
What's the procedure to directly import the same schema from here? I don't have an option to save it also.
Upvotes: 3
Views: 16924
Reputation: 53307
What you are after is called forward engineering. It means to take your model and create a real schema representation from it. Look in the Database menu. A detailed step-by-step instruction is here: https://dev.mysql.com/doc/workbench/en/wb-forward-engineering-live-server.html.
This approach is more of an occasional type, because it doesn't give you a way to keep your model updated when the db content changes. A better approach is synchronization (also see menu), which is a two-way tool to update both model and server. Always be careful when you work on a production server. There can be destructive changes (like dropping a column).
Upvotes: 6
Reputation: 4521
Okay I found one solution to such issue:
Basically you have copy each SQL Script from the tables, and run on the database side. Follow the following steps:
Right click on tables in ER diagram side, and select Copy SQL to clipboard
. Now you have the create command script on clipboard.
Create the same schema and paste each SQL Script from clipboard
.
Run each SQL script one by one, and you are done!
This is not the best way to do such things, so if you know better methods do suggest!
Upvotes: 2