Search code examples
command-linemysqlmysql-workbenchforward-engineer

Command line foward engineering using a .mwb file?


I need to be able to perform a forward engineering from a model located in a .mwb file. All of this from the command line as I would like to automate the process.

Can anyone please let me know if this is possible and if so how?


Solution

  • This is the output in the command line once you call WB with --help:

    mysql-workbench [<options>] [<model file>]
    Options:
      --force-sw-render      Force Xlib rendering
      --force-opengl-render  Force OpenGL rendering
      --query <connection>   Open a query tab to the named connection
      --admin <instance>     Open a administration tab to the named instance
      --model <model file>   Open the given EER model file
      --script <script file> Execute the given Python or Lua script file
      --run <script>         Execute the given code in default language for GRT shell
      --run-python <script>  Execute the given code in Python
      --run-lua <script>     Execute the given code in Lua
      --quit-when-done       Quit Workbench when the script is done
      --help, -h             Show command line options and exit
      --log-level=<level>    Valid levels are: error, warning, info, debug1, debug2, debug3
      --verbose              Enable diagnostics output
      --version              Show Workbench version number and exit
    

    I guess you can load your model using the --model option and then create an script that will perform the forward engineering and run it using the --run option and then instruct WB to exit once it finishes with the --quit-when-done option.

    You can consult WB help to learn more about creating scripts as well as this guide.