Question

There's a facility in MySQL Workbench's EER Modelling mode to write an SQL script that's stored with the model. But I've looked all over the place and can't see any way of executing such a script, other than by copying and pasting it into a window of the query mode. There's a menu item Scripting/Run Script, but it doesn't seem to actually do anything. Surely there must be some application of the scripts section of the model beyond just storing SQL text?

Was it helpful?

Solution

Running arbitrary SQL code during forward engineering or synchronization is not possible. The only code that gets executed is the sql to create the objects and to fill tables with data specified in the Inserts section of the table editor.

Running an sql script in general is of course possible and also trivial. Simply open a connection to your server (you should have one created on the home screen, if not do this first). Then in the editor toolbar there's a button to open a script. Use that to open the file (if you have a separate sql file). If you want to run code that is stored in the model (as SQL file) you have to copy/paste it over.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top