命令行使用.mwb文件进行工程设计?

bal*_*teo 7 mysql command-line forward-engineer mysqldump mysql-workbench

我需要能够从位于.mwb文件中的模型执行正向工程.所有这一切都来自命令行,因为我想自动化该过程.

任何人都可以告诉我,如果这是可能的,如果是这样的话怎么样?

Ser*_*gio 5

一旦您使用以下方法调用WB,这就是命令行中的输出--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
Run Code Online (Sandbox Code Playgroud)

我猜您可以使用该--model选项加载模型,然后创建一个脚本,该脚本将执行正向工程并使用该--run选项运行它,然后指示WB在完成--quit-when-done选项后退出.

您可以参考WB帮助以了解有关创建脚本以及本指南的更多信息.