Skip to content

Commit

Permalink
[Optimization] Default value judgment for supplementary types (#3475)
Browse files Browse the repository at this point in the history
Signed-off-by: Zzm0809 <934230207@qq.com>
Co-authored-by: Zzm0809 <Zzm0809@users.noreply.github.com>
  • Loading branch information
Zzm0809 and Zzm0809 committed May 14, 2024
1 parent e2070b7 commit e16b301
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ private String genTable(Table table) {
final String dv = column.getDefaultValue();
// If it defaults to a numeric type, there is no need to include single quotes or a bit type
String defaultValueTag = " DEFAULT '%s'";
if (NumberUtil.isNumber(dv) || columnType.startsWith("bit")) {
if (NumberUtil.isNumber(dv)
|| columnType.startsWith("bit")
|| (StrUtil.isNotEmpty(dv)
&& dv.toLowerCase().trim().matches("^current_timestamp.*"))) {
defaultValueTag = " DEFAULT %s";
}
String defaultValue = Asserts.isNotNull(dv)
Expand Down

0 comments on commit e16b301

Please sign in to comment.