mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-10-21 06:41:12 +00:00
[Clickhouse] Refactored columnNotNull
This commit is contained in:
+1
-5
@@ -14,6 +14,7 @@ public class ClickHouseDdl extends PlatformDdl {
|
||||
super(platform);
|
||||
this.includeStorageEngine = true;
|
||||
this.identitySuffix = "";
|
||||
this.columnNotNull = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -68,11 +69,6 @@ public class ClickHouseDdl extends PlatformDdl {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeColumnNotNull(DdlBuffer buffer) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTableComment(DdlBuffer apply, String tableName, String tableComment) {
|
||||
// do nothing
|
||||
|
||||
+4
-9
@@ -97,6 +97,8 @@ public class PlatformDdl {
|
||||
|
||||
protected String columnSetNull = "set null";
|
||||
|
||||
protected String columnNotNull = "not null";
|
||||
|
||||
protected String updateNullWithDefault = "update ${table} set ${column} = ${default} where ${column} is null";
|
||||
|
||||
protected String createTable = "create table";
|
||||
@@ -272,20 +274,13 @@ public class PlatformDdl {
|
||||
}
|
||||
}
|
||||
if (isTrue(column.isNotnull()) || isTrue(column.isPrimaryKey())) {
|
||||
writeColumnNotNull(buffer);
|
||||
buffer.appendWithSpace(columnNotNull);
|
||||
}
|
||||
|
||||
// add check constraints later as we really want to give them a nice name
|
||||
// so that the database can potentially provide a nice SQL error
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow for platform overriding (e.g. ClickHouse).
|
||||
*/
|
||||
protected void writeColumnNotNull(DdlBuffer buffer) {
|
||||
buffer.append(" not null");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the check constraint.
|
||||
*/
|
||||
@@ -556,7 +551,7 @@ public class PlatformDdl {
|
||||
|
||||
if (!onHistoryTable) {
|
||||
if (isTrue(column.isNotnull())) {
|
||||
writeColumnNotNull(buffer);
|
||||
buffer.appendWithSpace(columnNotNull);
|
||||
}
|
||||
buffer.append(addColumnSuffix);
|
||||
buffer.endOfStatement();
|
||||
|
||||
Reference in New Issue
Block a user