可用版本: Dev (3.21) | 最新 (3.20) | 3.19 | 3.18 | 3.17 | 3.16 | 3.15 | 3.14 | 3.13

Schema差异CLI

适用于 ✅ 开源版   ✅ 专业版   ✅ 企业版

我们已经在上一节关于 schema diff API 的内容中看到,schema diff API 可用于以编程方式生成 schema 版本之间的差异。此功能也可以在命令行上访问,如下所示

$ java -cp jooq-3.20.5.jar:reactive-streams-1.0.3.jar:r2dbc-spi-1.0.0.RELEASE.jar org.jooq.DiffCLI -h
Usage:
  -f / --formatted                          Format output SQL
  -h / --help                               Display this help
  -k / --keyword      <RenderKeywordStyle>  Specify the output keyword style (org.jooq.conf.RenderKeywordStyle)
  -i / --identifier   <RenderNameStyle>     Specify the output identifier style (org.jooq.conf.RenderNameStyle)
  -F / --from-dialect <SQLDialect>          Specify the input dialect (org.jooq.SQLDialect)
  -T / --to-dialect   <SQLDialect>          Specify the output dialect (org.jooq.SQLDialect)
  -1 / --sql1         <String>              Specify the input SQL string 1 (from SQL)
  -2 / --sql2         <String>              Specify the input SQL string 2 (to SQL)

$ java -cp jooq-3.20.5.jar:reactive-streams-1.0.3.jar:r2dbc-spi-1.0.0.RELEASE.jar org.jooq.DiffCLI -T POSTGRES -1 "create table t (i int);" -2 "create table t (i int, j int)"
alter table t add j int null;

Windows 用户:请在上面的示例中将 : 替换为 ;

使用此 API 的另一种方法是 https://jooq.org.cn/diff 网站。

反馈

您对此页面有任何反馈吗? 我们很乐意听取您的意见!

The jOOQ Logo