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.using(dialect).alterTable(table("tableName"))
.add(field(name("newColName"),VARCHAR(32).nullable(false)))
CodePudding user response:
It works the same way as nullable()
, directly on the type. Use
VARCHAR(32).nullable(false).default_("abc")