简体   繁体   English

JOOQ如何将具有默认值的列添加到现有表中

[英]JOOQ how to add column with default value into an existing table

The below DSL can add new column with nullable to existing table, but i don't know how to add a default value in this DSL.下面的 DSL 可以向现有表添加可为空的新列,但我不知道如何在此 DSL 中添加默认值。

DSL.using(dialect).alterTable(table("tableName"))
                    .add(field(name("newColName"),VARCHAR(32).nullable(false)))

It works the same way as nullable() , directly on the type.它的工作方式与nullable()相同,直接在类型上。 Use利用

VARCHAR(32).nullable(false).default_("abc")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM