#2547 - Cockroach identity DDL - Changing to use standard GENERATED ... AS IDENTITY syntax

This commit is contained in:
Rob Bygrave
2022-02-04 08:40:23 +13:00
parent 9ea2811aa3
commit a72cbaf243
4 changed files with 11 additions and 22 deletions
@@ -280,7 +280,7 @@ public final class InternalConfiguration {
private MultiValueBind createMultiValueBind(Platform platform) {
// only Postgres at this stage
if (platform.base() == Platform.POSTGRES || platform.base() == Platform.YUGABYTE) {
if (platform.base() == Platform.POSTGRES || platform.base() == Platform.YUGABYTE || platform.base() == Platform.COCKROACH) {
return new PostgresMultiValueBind();
}
return new MultiValueBind();
@@ -202,7 +202,8 @@ public final class DefaultTypeManager implements TypeManager {
private boolean isPostgresCompatible(DatabasePlatform databasePlatform) {
return databasePlatform.isPlatform(Platform.POSTGRES)
|| databasePlatform.isPlatform(Platform.YUGABYTE);
|| databasePlatform.isPlatform(Platform.YUGABYTE)
|| databasePlatform.isPlatform(Platform.COCKROACH);
}
private boolean hstoreSupport() {
@@ -21,21 +21,9 @@ public class CockroachDdl extends PlatformDdl {
return NativeDbArray.logicalToNative(logicalArrayType);
}
/**
* Map bigint, integer and smallint all into serial.
*/
@Override
public String asIdentityColumn(String columnDefn, DdlIdentity identity) {
if ("bigint".equalsIgnoreCase(columnDefn)) {
return "serial";
}
if ("integer".equalsIgnoreCase(columnDefn)) {
return "serial";
}
if ("smallint".equalsIgnoreCase(columnDefn)) {
return "serial";
}
return columnDefn;
return asIdentityStandardOptions(columnDefn, identity);
}
@Override
@@ -1,16 +1,16 @@
package main;
//import io.ebean.docker.commands.CockroachConfig;
//import io.ebean.docker.commands.CockroachContainer;
import io.ebean.docker.commands.CockroachConfig;
import io.ebean.docker.commands.CockroachContainer;
public class StartCockroach {
public static void main(String[] args) {
// CockroachConfig config = new CockroachConfig();
// config.setDbName("unit");
//
// CockroachContainer container = new CockroachContainer(config);
// container.startWithDropCreate();
CockroachConfig config = new CockroachConfig("v21.2.4");
config.setDbName("unit");
CockroachContainer container = new CockroachContainer(config);
container.start();
}
}