Reputation: 1617
Originally, I used Data Modelling in MySQL Workbench to design a database consisting of a series of tables (i.e. the columns and relationships).
Then using Database -> Forward Engineer, I created a database, and inserted data into the tables.
Now I've realised that the model I've designed needs some changes, and so I've altered some tables by inserted columns. My question is, how do I get MySQL Workbench to alter the tables?
Using Database -> Synchronize Model, Update Source just generates a bunch of CREATE TABLE IF NOT EXISTS sql statements, and as the tables exist, nothing changes.
Upvotes: 7
Views: 2724
Reputation: 2105
The 2011 answer is no longer up to date. I struggled to find the option in a recent version. Here is the new procedure (works for MySQLWorkbench 6.2 at least):
When you have finished editing your model, open Database -> Synchronize with Any Source
In the step Select Source
you have 3 parts
Model Schemadata
Live Database Server
.sql
fileProceed in the wizard, you can then review the tables and sql queries that will be executed. You can also ignore the update of some tables.
Upvotes: 0
Reputation: 3152
What you are looking for is in the model menu Database / Synchronize model.
Upvotes: 8
Reputation: 1617
As I couldn't get get File -> Export -> Forward Engineer SQL ALTER Script
to work, so I made a backup of the data, dropped the tables, recreated them, and then imported the data. I'd rather find a way to get MySQL Workbench to generate ALTER commands from the changes in my model
Upvotes: 3