diff --git a/plugins/dbgate-plugin-clickhouse/src/backend/Analyser.js b/plugins/dbgate-plugin-clickhouse/src/backend/Analyser.js index ea34369e..77478449 100644 --- a/plugins/dbgate-plugin-clickhouse/src/backend/Analyser.js +++ b/plugins/dbgate-plugin-clickhouse/src/backend/Analyser.js @@ -45,6 +45,7 @@ class Analyser extends DatabaseAnalyser { .filter((col) => col.pureName == table.pureName) .map((col) => ({ ...col, + defaultValue: col.defaultValue ? col.defaultValue : undefined, ...extractDataType(col.dataType), })), primaryKey: table.primaryKeyColumns diff --git a/plugins/dbgate-plugin-clickhouse/src/frontend/Dumper.js b/plugins/dbgate-plugin-clickhouse/src/frontend/Dumper.js index 0874a583..ada5adb7 100644 --- a/plugins/dbgate-plugin-clickhouse/src/frontend/Dumper.js +++ b/plugins/dbgate-plugin-clickhouse/src/frontend/Dumper.js @@ -13,6 +13,9 @@ class Dumper extends SqlDumper { this.put('^alter ^table %f ^modify ^column %i ', newcol, newcol.columnName); this.columnDefinition(newcol); + if (oldcol.defaultValue != null && newcol.defaultValue == null) { + this.put(' ^remove ^default '); + } this.endCommand(); }