Merge branch 'ddl-clickhouse' of https://github.com/FOCONIS/ebean into FOCONIS-ddl-clickhouse

This commit is contained in:
Rob Bygrave
2022-03-14 16:51:27 +13:00
4 changed files with 8 additions and 3 deletions
@@ -18,6 +18,8 @@ public class ClickHousePlatform extends DatabasePlatform {
//this.exceptionTranslator =
this.nativeUuidType = true;
this.dbDefaultValue.setNow("now()");
this.dbDefaultValue.setFalse("0");
this.dbDefaultValue.setTrue("1");
this.dbIdentity.setIdType(IdType.IDENTITY);
this.dbIdentity.setSupportsGetGeneratedKeys(false);
@@ -106,7 +106,10 @@ final class DScriptRunner implements ScriptRunner {
try (Connection connection = obtainConnection()) {
DdlRunner runner = new DdlRunner(useAutoCommit, scriptName, platformName);
runner.runAll(content, connection);
connection.commit();
if (!connection.getAutoCommit()) {
// Clickhouse fails: Cannot commit when auto-commit is enabled
connection.commit();
}
runner.runNonTransactional(connection);
}
@@ -53,7 +53,7 @@ create table migtest_e_basic (
description String,
description_file blob,
some_date DateTime,
old_boolean UInt8 default false,
old_boolean UInt8 default 0,
old_boolean2 UInt8,
eref_id UInt32,
indextest1 String,
@@ -30,7 +30,7 @@ alter table migtest_e_basic alter column status2 set not null;
alter table migtest_e_basic alter column user_id set default 23;
alter table migtest_e_basic alter column user_id set not null;
alter table migtest_e_basic add column description_file blob;
alter table migtest_e_basic add column old_boolean UInt8 default false;
alter table migtest_e_basic add column old_boolean UInt8 default 0;
alter table migtest_e_basic add column old_boolean2 UInt8;
alter table migtest_e_basic add column eref_id UInt32;
alter table migtest_e_history2 alter column test_string drop default;