Skip to content

Commit 9fc33ce

Browse files
committed
Fixed Syntax issue regarding column default value
1 parent 26b2ca4 commit 9fc33ce

File tree

1 file changed

+4
-2
lines changed
  • src/main/java/me/cobeine/sqlava/connection/database/table/column

1 file changed

+4
-2
lines changed

src/main/java/me/cobeine/sqlava/connection/database/table/column/Column.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ public Column size(int size) {
3737
}
3838

3939
public Column defaultValue(Object defaultValue) {
40+
if (defaultValue instanceof String){
41+
defaultValue = "'" + defaultValue + "'";
42+
}
4043
this.defaultValue = defaultValue;
4144
return this;
4245
}
@@ -61,8 +64,7 @@ public String toString() {
6164
builder.deleteCharAt(builder.length() - 1);
6265
}
6366
if (defaultValue != null && !settings.contains(ColumnSettings.AUTO_INCREMENT)) {
64-
builder.append(" DEFAULT '")
65-
.append((defaultValue instanceof String ? "'" + defaultValue + "'" : defaultValue)).append("'");
67+
builder.append(" DEFAULT ").append(defaultValue);
6668
}
6769
return builder.toString();
6870
}

0 commit comments

Comments
 (0)