Search code examples
mysqlsqlmysql-workbenchworkbench

Generate SQL with Workbench


Suppose I have a database diagram (Entity Relationship) in its version number 57, then I modify the diagram creating version 58 (I add 2 tables), I need Workbench to generate a file with extension "sql" with the code sql difference between version 57 and 58, that is, a file with the code of the 2 tables created recently, I know it is possible but I do not know how to do it.

I was doing tests in Workbench, and I was able to modify the diagram and export the SQL file, but it absolutely exported all the tables.


Solution

  • You cannot create a diff between 2 models, but you can create one from the model version 57 and an SQL file exported from your model version 58. Use "Synchronize with any source" for that:

    Open your model version 57. Once loaded go to the Database menu where you can find the synchronization entries. Launching the any source sync will show you a wizard where you can select the SQL for version 58 and a target (DB server or SQL script) which receives the SQL statements to transform version 57 to 58.