更新时间:2023-02-07 13:10:02
您实际上可以使用Python(或Lua)脚本自动执行此任务-MySQL Workbench在Scripting
菜单下已经具有解释器.创建一个新脚本并使用存根:
You can actually automate this task with Python (or Lua) script - MySQL Workbench already has an interpreter under Scripting
menu. Create a new script and use the stub:
# -*- coding: utf-8 -*-
import os
import grt
from grt.modules import DbMySQLFE
c = grt.root.wb.doc.physicalModels[0].catalog
DbMySQLFE.generateSQLCreateStatements(c, c.version, {
'GenerateDrops' : 1,
'GenerateSchemaDrops' : 1,
'OmitSchemata' : 1,
'GenerateUse' : 1
})
DbMySQLFE.generateSQLCreateStatements(c, c.version, {
DbMySQLFE.createScriptForCatalogObjects(os.path.dirname(grt.root.wb.docPath) + 'ddl.sql', c, {})
它不能从命令行强制运行,但是我相信您可以使用--run-script
选项运行它.
It does not actully run from command line, but I beleive you can run it with --run-script
option.