diff --git a/ebean-api/src/main/java/io/ebean/config/dbplatform/DbPlatformType.java b/ebean-api/src/main/java/io/ebean/config/dbplatform/DbPlatformType.java index 13c0d1fcb7..9ac1cf09da 100644 --- a/ebean-api/src/main/java/io/ebean/config/dbplatform/DbPlatformType.java +++ b/ebean-api/src/main/java/io/ebean/config/dbplatform/DbPlatformType.java @@ -28,6 +28,16 @@ public class DbPlatformType implements ExtraDbTypes { */ private final boolean canHaveLength; + /** + * The maximum length supported by this platform type. If length is too big, fallback is used. + */ + private final int maxLength; + + /** + * Use this platform type if length exceedes + */ + private final DbPlatformType fallback; + /** * Parse a type definition into a DbPlatformType. *

@@ -53,6 +63,41 @@ public DbPlatformType(String name, int defaultLength) { this(name, defaultLength, 0); } + /** + * Construct without length, but with a max length limit and a fallback type, that is used if maxLength is exceeded. + * This can be used to use

+ */ + public DbPlatformType(String name, int maxLength, DbPlatformType fallback) { + this.name = name; + this.defaultLength = 0; + this.defaultScale = 0; + this.canHaveLength = false; + this.maxLength = maxLength; + this.fallback = fallback; + } + + /** + * Construct with a given default length, a max length limit and a fallback type, that is used if maxLength is exceeded. + * This can be used to use + */ + public DbPlatformType(String name, int defaultPrecision, int maxLength, DbPlatformType fallback) { + this.name = name; + this.defaultLength = defaultPrecision; + this.defaultScale = 0; + this.canHaveLength = true; + this.maxLength = maxLength; + this.fallback = fallback; + } + /** * Construct for Decimal with precision and scale. */ @@ -61,6 +106,8 @@ public DbPlatformType(String name, int defaultPrecision, int defaultScale) { this.defaultLength = defaultPrecision; this.defaultScale = defaultScale; this.canHaveLength = true; + this.maxLength = Integer.MAX_VALUE; + this.fallback = null; } /** @@ -74,6 +121,8 @@ public DbPlatformType(String name, boolean canHaveLength) { this.defaultLength = 0; this.defaultScale = 0; this.canHaveLength = canHaveLength; + this.maxLength = Integer.MAX_VALUE; + this.fallback = null; } /** @@ -124,33 +173,33 @@ public String renderType(int deployLength, int deployScale) { */ public String renderType(int deployLength, int deployScale, boolean strict) { - StringBuilder sb = new StringBuilder(); - sb.append(name); - if (canHaveLength || !strict) { - renderLengthScale(deployLength, deployScale, sb); - } + int len = deployLength != 0 ? deployLength : defaultLength; + if (len > maxLength) { + return fallback.renderType(deployLength, deployScale, strict); + } else { + StringBuilder sb = new StringBuilder(); + sb.append(name); + if ((canHaveLength || !strict) && len > 0) { + renderLengthScale(len, deployScale, sb); + } - return sb.toString(); + return sb.toString(); + } } /** * Render the length and scale part of the column definition. */ - protected void renderLengthScale(int deployLength, int deployScale, StringBuilder sb) { + protected void renderLengthScale(int len, int deployScale, StringBuilder sb) { // see if there is a precision/scale to add (or not) - int len = deployLength != 0 ? deployLength : defaultLength; - if (len == Integer.MAX_VALUE) { - sb.append("(max)"); // TODO: this is sqlserver specific - } else if (len > 0) { - sb.append("("); - sb.append(len); - int scale = deployScale != 0 ? deployScale : defaultScale; - if (scale > 0) { - sb.append(","); - sb.append(scale); - } - sb.append(")"); + sb.append('('); + sb.append(len); + int scale = deployScale != 0 ? deployScale : defaultScale; + if (scale > 0) { + sb.append(','); + sb.append(scale); } + sb.append(')'); } /** diff --git a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/ClickHouseDbArray.java b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/ClickHouseDbArray.java index 469e584201..14838952c7 100644 --- a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/ClickHouseDbArray.java +++ b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/ClickHouseDbArray.java @@ -15,6 +15,7 @@ class ClickHouseDbArray { mapping.put("integer[]", "Array(UInt32)"); mapping.put("bigint[]", "Array(UInt64)"); mapping.put("float[]", "Array(Float32)"); + mapping.put("float4[]", "Array(Float32)"); mapping.put("decimal[]", "Array(Decimal)"); } diff --git a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/PlatformDdl.java b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/PlatformDdl.java index d7e825e862..81342078b8 100644 --- a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/PlatformDdl.java +++ b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/PlatformDdl.java @@ -279,7 +279,13 @@ public String convert(String type) { if (type == null) { return null; } - type = extract(type); + String[] tmp = type.split(";", -1); // do not discard trailing empty strings + int index = extract(tmp); + if (index < tmp.length - 1) { + // this is a platform specific definition. So do not apply further conversions + return tmp[index]; + } + type = tmp[index]; if (type.contains("[]")) { return convertArrayType(type); } @@ -294,18 +300,22 @@ protected String extract(String type) { return null; } String[] tmp = type.split(";", -1); // do not discard trailing empty strings - if (tmp.length % 2 == 0) { - throw new IllegalArgumentException("You need an odd number of arguments in '" + type + "'. See Issue #2559 for details"); + return tmp[extract(tmp)]; // else + } + + protected int extract(String[] types) { + if (types.length % 2 == 0) { + throw new IllegalArgumentException("You need an odd number of arguments in '" + String.join(";", types) + "'. See Issue #2559 for details"); } - for (int i = 0; i < tmp.length - 2; i += 2) { - String[] platforms = tmp[i].split(","); + for (int i = 0; i < types.length - 2; i += 2) { + String[] platforms = types[i].split(","); for (String plat : platforms) { if (platform.isPlatform(Platform.valueOf(plat.toUpperCase(Locale.ENGLISH)))) { - return tmp[i + 1]; + return i + 1; } } } - return tmp[tmp.length - 1]; // else + return types.length - 1; // else } /** diff --git a/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/MySqlPlatformTest.java b/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/MySqlPlatformTest.java index d94c17f6ae..305a27a4d6 100644 --- a/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/MySqlPlatformTest.java +++ b/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/MySqlPlatformTest.java @@ -10,17 +10,23 @@ public class MySqlPlatformTest { MySqlPlatform mySqlPlatform = new MySqlPlatform(); - +private static int X = 0xFFFFFF; @Test public void testTypeConversion() { PlatformDdl ddl = PlatformDdlBuilder.create(mySqlPlatform); assertThat(ddl.convert("clob")).isEqualTo("longtext"); + assertThat(ddl.convert("clob(65535)")).isEqualTo("text"); + assertThat(ddl.convert("clob(65536)")).isEqualTo("mediumtext"); + assertThat(ddl.convert("clob(16777215)")).isEqualTo("mediumtext"); + assertThat(ddl.convert("clob(16777216)")).isEqualTo("longtext"); assertThat(ddl.convert("json")).isEqualTo("json"); assertThat(ddl.convert("jsonb")).isEqualTo("json"); assertThat(ddl.convert("varchar(20)")).isEqualTo("varchar(20)"); assertThat(ddl.convert("boolean")).isEqualTo("tinyint(1)"); assertThat(ddl.convert("bit")).isEqualTo("tinyint(1)"); assertThat(ddl.convert("decimal")).isEqualTo("decimal(16,3)"); + + } } diff --git a/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/SqlserverPlatformTest.java b/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/SqlserverPlatformTest.java index 402f7bfa95..407b80b727 100644 --- a/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/SqlserverPlatformTest.java +++ b/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/SqlserverPlatformTest.java @@ -19,7 +19,7 @@ public void testTypeConversion() { PlatformDdl ddl = PlatformDdlBuilder.create(platform); assertThat(ddl.convert("clob")).isEqualTo("nvarchar(max)"); - assertThat(ddl.convert("blob")).isEqualTo("image"); + assertThat(ddl.convert("blob")).isEqualTo("varbinary(max)"); assertThat(ddl.convert("json")).isEqualTo("nvarchar(max)"); assertThat(ddl.convert("jsonb")).isEqualTo("nvarchar(max)"); @@ -32,6 +32,10 @@ public void testTypeConversion() { assertThat(ddl.convert("bit")).isEqualTo("bit"); assertThat(ddl.convert("tinyint")).isEqualTo("smallint"); assertThat(ddl.convert("binary(16)")).isEqualTo("binary(16)"); + + assertThat(ddl.convert("varchar")).isEqualTo("nvarchar(255)"); + assertThat(ddl.convert("varchar(4000)")).isEqualTo("nvarchar(4000)"); + assertThat(ddl.convert("varchar(4001)")).isEqualTo("nvarchar(max)"); } @Test diff --git a/ebean-test/src/main/java/io/ebean/test/config/platform/ClickHouseSetup.java b/ebean-test/src/main/java/io/ebean/test/config/platform/ClickHouseSetup.java index a2a6ca0e0c..17b19a38a1 100644 --- a/ebean-test/src/main/java/io/ebean/test/config/platform/ClickHouseSetup.java +++ b/ebean-test/src/main/java/io/ebean/test/config/platform/ClickHouseSetup.java @@ -12,7 +12,7 @@ public Properties setup(Config config) { config.setUsername("default"); config.setPassword(""); config.setUrl("jdbc:clickhouse://${host}:${port}/${databaseName}"); - config.setDriver("ru.yandex.clickhouse.ClickHouseDriver"); + config.setDriver("com.clickhouse.jdbc.ClickHouseDriver"); config.datasourceDefaults(); return dockerProperties(config); diff --git a/ebean-test/src/test/java/io/ebean/xtest/config/dbplatform/DbTypeMapTest.java b/ebean-test/src/test/java/io/ebean/xtest/config/dbplatform/DbTypeMapTest.java index bafb9e8f8e..5955429e84 100644 --- a/ebean-test/src/test/java/io/ebean/xtest/config/dbplatform/DbTypeMapTest.java +++ b/ebean-test/src/test/java/io/ebean/xtest/config/dbplatform/DbTypeMapTest.java @@ -62,7 +62,7 @@ void testLookupRender_given_sqlserver17() { assertThat(dbTypeMap.lookup("json", false).renderType(0, 0)).isEqualTo("nvarchar(max)"); assertThat(dbTypeMap.lookup("jsonb", false).renderType(0, 0)).isEqualTo("nvarchar(max)"); assertThat(dbTypeMap.lookup("jsonclob", false).renderType(0, 0)).isEqualTo("nvarchar(max)"); - assertThat(dbTypeMap.lookup("jsonblob", false).renderType(0, 0)).isEqualTo("image"); + assertThat(dbTypeMap.lookup("jsonblob", false).renderType(0, 0)).isEqualTo("varbinary(max)"); assertThat(dbTypeMap.lookup("jsonvarchar", false).renderType(200, 0)).isEqualTo("nvarchar(200)"); } diff --git a/ebean-test/src/test/java/io/ebean/xtest/dbmigration/DbMigrationTest.java b/ebean-test/src/test/java/io/ebean/xtest/dbmigration/DbMigrationTest.java index 50a66e6d3b..dde75bf9e7 100644 --- a/ebean-test/src/test/java/io/ebean/xtest/dbmigration/DbMigrationTest.java +++ b/ebean-test/src/test/java/io/ebean/xtest/dbmigration/DbMigrationTest.java @@ -57,6 +57,10 @@ public void testRunMigration() throws IOException, SQLException { "migtest_ckey_detail", "migtest_ckey_parent", "migtest_e_basic", + "migtest_e_test_binary", + "migtest_e_test_varchar", + "migtest_e_test_lob", + "migtest_e_test_json", "migtest_e_enum", "migtest_e_history", "migtest_e_history2", diff --git a/ebean-test/src/test/java/misc/migration/v1_1/ETestBinary.java b/ebean-test/src/test/java/misc/migration/v1_1/ETestBinary.java new file mode 100644 index 0000000000..215b0890f0 --- /dev/null +++ b/ebean-test/src/test/java/misc/migration/v1_1/ETestBinary.java @@ -0,0 +1,72 @@ +package misc.migration.v1_1; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.validation.constraints.Size; + +@Entity +@Table(name = "migtest_e_test_binary") +public class ETestBinary { + + @Id + int id; + + @Size(max = 16) + byte[] test_byte16; + + @Size(max = 256) + byte[] test_byte256; + + @Size(max = 512) + byte[] test_byte512; + + @Size(max = 1024) + byte[] test_byte1k; + + @Size(max = 2 * 1024) + byte[] test_byte2k; + + @Size(max = 4 * 1024) + byte[] test_byte4k; + + @Size(max = 8 * 1024) + byte[] test_byte8k; + + @Size(max = 16 * 1024) + byte[] test_byte16k; + + @Size(max = 32 * 1024) + byte[] test_byte32k; + + @Size(max = 64 * 1024) + byte[] test_byte64k; + + @Size(max = 128 * 1024) + byte[] test_byte128k; + + @Size(max = 256 * 1024) + byte[] test_byte256k; + + @Size(max = 512 * 1024) + byte[] test_byte512k; + + @Size(max = 1024 * 1024) + byte[] test_byte1m; + + @Size(max = 2 * 1024 * 1024) + byte[] test_byte2m; + + @Size(max = 4 * 1024 * 1024) + byte[] test_byte4m; + + @Size(max = 8 * 1024 * 1024) + byte[] test_byte8m; + + @Size(max = 16 * 1024 * 1024) + byte[] test_byte16m; + + @Size(max = 32 * 1024 * 1024) + byte[] test_byte32m; + +} diff --git a/ebean-test/src/test/java/misc/migration/v1_1/ETestJson.java b/ebean-test/src/test/java/misc/migration/v1_1/ETestJson.java new file mode 100644 index 0000000000..7405b2f011 --- /dev/null +++ b/ebean-test/src/test/java/misc/migration/v1_1/ETestJson.java @@ -0,0 +1,74 @@ +package misc.migration.v1_1; + +import io.ebean.annotation.DbJson; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import java.util.List; + +@Entity +@Table(name = "migtest_e_test_json") +public class ETestJson { + + @Id + int id; + + @DbJson(length = 255) + List json255; + + @DbJson(length = 256) + List json256; + + @DbJson(length = 512) + List json512; + + @DbJson(length = 1024) + List json1k; + + @DbJson(length = 2 * 1024) + List json2k; + + @DbJson(length = 4 * 1024) + List json4k; + + @DbJson(length = 8 * 1024) + List json8k; + + @DbJson(length = 16 * 1024) + List json16k; + + @DbJson(length = 32 * 1024) + List json32k; + + @DbJson(length = 64 * 1024) + List json64k; + + @DbJson(length = 128 * 1024) + List json128k; + + @DbJson(length = 256 * 1024) + List json256k; + + @DbJson(length = 512 * 1024) + List json512k; + + @DbJson(length = 1024 * 1024) + List json1m; + + @DbJson(length = 2 * 1024 * 1024) + List json2m; + + @DbJson(length = 4 * 1024 * 1024) + List json4m; + + @DbJson(length = 8 * 1024 * 1024) + List json8m; + + @DbJson(length = 16 * 1024 * 1024) + List json16m; + + @DbJson(length = 32 * 1024 * 1024) + List json32m; + +} diff --git a/ebean-test/src/test/java/misc/migration/v1_1/ETestLob.java b/ebean-test/src/test/java/misc/migration/v1_1/ETestLob.java new file mode 100644 index 0000000000..c73428254d --- /dev/null +++ b/ebean-test/src/test/java/misc/migration/v1_1/ETestLob.java @@ -0,0 +1,92 @@ +package misc.migration.v1_1; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Lob; +import javax.persistence.Table; +import javax.validation.constraints.Size; + +@Entity +@Table(name = "migtest_e_test_lob") +public class ETestLob { + + @Id + int id; + + @Size(max = 255) + @Lob + String lob255; + + @Size(max = 256) + @Lob + String lob256; + + @Size(max = 512) + @Lob + String lob512; + + @Size(max = 1024) + @Lob + String lob1k; + + @Size(max = 2 * 1024) + @Lob + String lob2k; + + @Size(max = 4 * 1024) + @Lob + String lob4k; + + @Size(max = 8 * 1024) + @Lob + String lob8k; + + @Size(max = 16 * 1024) + @Lob + String lob16k; + + @Size(max = 32 * 1024) + @Lob + String lob32k; + + @Size(max = 64 * 1024) + @Lob + String lob64k; + + @Size(max = 128 * 1024) + @Lob + String lob128k; + + @Size(max = 256 * 1024) + @Lob + String lob256k; + + @Size(max = 512 * 1024) + @Lob + String lob512k; + + @Size(max = 1024 * 1024) + @Lob + String lob1m; + + @Size(max = 2 * 1024 * 1024) + @Lob + String lob2m; + + @Size(max = 4 * 1024 * 1024) + @Lob + String lob4m; + + @Size(max = 8 * 1024 * 1024) + @Lob + String lob8m; + + @Size(max = 16 * 1024 * 1024) + @Lob + String lob16m; + + @Size(max = 32 * 1024 * 1024) + @Lob + String lob32m; + +} diff --git a/ebean-test/src/test/java/misc/migration/v1_1/ETestVarchar.java b/ebean-test/src/test/java/misc/migration/v1_1/ETestVarchar.java new file mode 100644 index 0000000000..2ec1cc61d8 --- /dev/null +++ b/ebean-test/src/test/java/misc/migration/v1_1/ETestVarchar.java @@ -0,0 +1,75 @@ +package misc.migration.v1_1; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.validation.constraints.Size; + +@Entity +@Table(name = "migtest_e_test_varchar") +public class ETestVarchar { + + @Id + int id; + + @Size(max = 255) + String varchar255; + + @Size(max = 256) + String varchar256; + + @Size(max = 512) + String varchar512; + + @Size(max = 1024) + String varchar1k; + + @Size(max = 2 * 1024) + String varchar2k; + + @Size(max = 4 * 1024) + String varchar4k; + + // Override definition for MariaDB + @Column(columnDefinition = "mariadb,mysql;varchar(8193);") + @Size(max = 8 * 1024) + String varchar8k; + + @Size(max = 16 * 1024) + String varchar16k; + + @Size(max = 32 * 1024) + String varchar32k; + + @Size(max = 64 * 1024) + String varchar64k; + + @Size(max = 128 * 1024) + String varchar128k; + + @Size(max = 256 * 1024) + String varchar256k; + + @Size(max = 512 * 1024) + String varchar512k; + + @Size(max = 1024 * 1024) + String varchar1m; + + @Size(max = 2 * 1024 * 1024) + String varchar2m; + + @Size(max = 4 * 1024 * 1024) + String varchar4m; + + @Size(max = 8 * 1024 * 1024) + String varchar8m; + + @Size(max = 16 * 1024 * 1024) + String varchar16m; + + @Size(max = 32 * 1024 * 1024) + String varchar32m; + +} diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/clickhouse/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/clickhouse/1.1.sql index 9e681c9170..6effd3ba35 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/clickhouse/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/clickhouse/1.1.sql @@ -24,6 +24,98 @@ create table drop_ref_one ( parent_id UInt32 ) ENGINE = Log(); +create table migtest_e_test_binary ( + id UInt32, + test_byte16 String, + test_byte256 String, + test_byte512 String, + test_byte1k String, + test_byte2k String, + test_byte4k String, + test_byte8k String, + test_byte16k String, + test_byte32k String, + test_byte64k String, + test_byte128k String, + test_byte256k String, + test_byte512k String, + test_byte1m String, + test_byte2m String, + test_byte4m String, + test_byte8m String, + test_byte16m String, + test_byte32m String +) ENGINE = Log(); + +create table migtest_e_test_json ( + id UInt32, + json255 String, + json256 String, + json512 String, + json1k String, + json2k String, + json4k String, + json8k String, + json16k String, + json32k String, + json64k String, + json128k String, + json256k String, + json512k String, + json1m String, + json2m String, + json4m String, + json8m String, + json16m String, + json32m String +) ENGINE = Log(); + +create table migtest_e_test_lob ( + id UInt32, + lob255 String, + lob256 String, + lob512 String, + lob1k String, + lob2k String, + lob4k String, + lob8k String, + lob16k String, + lob32k String, + lob64k String, + lob128k String, + lob256k String, + lob512k String, + lob1m String, + lob2m String, + lob4m String, + lob8m String, + lob16m String, + lob32m String +) ENGINE = Log(); + +create table migtest_e_test_varchar ( + id UInt32, + varchar255 String, + varchar256 String, + varchar512 String, + varchar1k String, + varchar2k String, + varchar4k String, + varchar8k String, + varchar16k String, + varchar32k String, + varchar64k String, + varchar128k String, + varchar256k String, + varchar512k String, + varchar1m String, + varchar2m String, + varchar4m String, + varchar8m String, + varchar16m String, + varchar32m String +) ENGINE = Log(); + create table migtest_e_user ( id UInt32 ) ENGINE = Log(); diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/clickhouse/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/clickhouse/1.4__dropsFor_1.3.sql index 52fd62211c..d66b81f566 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/clickhouse/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/clickhouse/1.4__dropsFor_1.3.sql @@ -21,6 +21,10 @@ drop table if exists drop_main; drop table if exists drop_main_drop_ref_many; drop table if exists drop_ref_many; drop table if exists drop_ref_one; +drop table if exists migtest_e_test_binary; +drop table if exists migtest_e_test_json; +drop table if exists migtest_e_test_lob; +drop table if exists migtest_e_test_varchar; drop table if exists migtest_e_user; drop table if exists migtest_mtm_c_migtest_mtm_m; drop table if exists migtest_mtm_m_migtest_mtm_c; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/clickhouse/idx_clickhouse.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/clickhouse/idx_clickhouse.migrations index c38e16579f..f6de06da55 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/clickhouse/idx_clickhouse.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/clickhouse/idx_clickhouse.migrations @@ -1,6 +1,6 @@ 193400547, 1.0__initial.sql --572177405, 1.1.sql +1036221356, 1.1.sql 688811494, 1.2__dropsFor_1.1.sql 1015552567, 1.3.sql -677297367, 1.4__dropsFor_1.3.sql +-252580551, 1.4__dropsFor_1.3.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/cockroach/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/cockroach/1.1.sql index 72b163ae6b..a450821e05 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/cockroach/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/cockroach/1.1.sql @@ -33,6 +33,102 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table migtest_e_test_binary ( + id integer generated by default as identity not null, + test_byte16 bytea, + test_byte256 bytea, + test_byte512 bytea, + test_byte1k bytea, + test_byte2k bytea, + test_byte4k bytea, + test_byte8k bytea, + test_byte16k bytea, + test_byte32k bytea, + test_byte64k bytea, + test_byte128k bytea, + test_byte256k bytea, + test_byte512k bytea, + test_byte1m bytea, + test_byte2m bytea, + test_byte4m bytea, + test_byte8m bytea, + test_byte16m bytea, + test_byte32m bytea, + constraint pk_migtest_e_test_binary primary key (id) +); + +create table migtest_e_test_json ( + id integer generated by default as identity not null, + json255 json, + json256 json, + json512 json, + json1k json, + json2k json, + json4k json, + json8k json, + json16k json, + json32k json, + json64k json, + json128k json, + json256k json, + json512k json, + json1m json, + json2m json, + json4m json, + json8m json, + json16m json, + json32m json, + constraint pk_migtest_e_test_json primary key (id) +); + +create table migtest_e_test_lob ( + id integer generated by default as identity not null, + lob255 text, + lob256 text, + lob512 text, + lob1k text, + lob2k text, + lob4k text, + lob8k text, + lob16k text, + lob32k text, + lob64k text, + lob128k text, + lob256k text, + lob512k text, + lob1m text, + lob2m text, + lob4m text, + lob8m text, + lob16m text, + lob32m text, + constraint pk_migtest_e_test_lob primary key (id) +); + +create table migtest_e_test_varchar ( + id integer generated by default as identity not null, + varchar255 varchar(255), + varchar256 varchar(256), + varchar512 varchar(512), + varchar1k varchar(1024), + varchar2k varchar(2048), + varchar4k varchar(4096), + varchar8k varchar(8192), + varchar16k varchar(16384), + varchar32k varchar(32768), + varchar64k varchar(65536), + varchar128k varchar(131072), + varchar256k varchar(262144), + varchar512k varchar(524288), + varchar1m varchar(1048576), + varchar2m varchar(2097152), + varchar4m varchar(4194304), + varchar8m varchar(8388608), + varchar16m text, + varchar32m text, + constraint pk_migtest_e_test_varchar primary key (id) +); + create table migtest_e_user ( id integer generated by default as identity not null, constraint pk_migtest_e_user primary key (id) diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/cockroach/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/cockroach/1.4__dropsFor_1.3.sql index 27c0b1b7fb..099bdbad8c 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/cockroach/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/cockroach/1.4__dropsFor_1.3.sql @@ -24,6 +24,14 @@ drop table if exists drop_ref_many cascade; drop sequence if exists drop_ref_many_seq; drop table if exists drop_ref_one cascade; drop sequence if exists drop_ref_one_seq; +drop table if exists migtest_e_test_binary cascade; +drop sequence if exists migtest_e_test_binary_seq; +drop table if exists migtest_e_test_json cascade; +drop sequence if exists migtest_e_test_json_seq; +drop table if exists migtest_e_test_lob cascade; +drop sequence if exists migtest_e_test_lob_seq; +drop table if exists migtest_e_test_varchar cascade; +drop sequence if exists migtest_e_test_varchar_seq; drop table if exists migtest_e_user cascade; drop sequence if exists migtest_e_user_seq; drop table if exists migtest_mtm_c_migtest_mtm_m cascade; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/cockroach/idx_cockroach.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/cockroach/idx_cockroach.migrations index f7a5c61fa5..8688ba882e 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/cockroach/idx_cockroach.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/cockroach/idx_cockroach.migrations @@ -1,7 +1,7 @@ 1434934404, 1.0__initial.sql --1182436907, 1.1.sql +-1445091875, 1.1.sql 856096334, 1.2__dropsFor_1.1.sql -279468991, 1.3.sql -2137365848, 1.4__dropsFor_1.3.sql +-1398154763, 1.4__dropsFor_1.3.sql 561281075, R__order_views.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/1.1.sql index 03f5e189be..cff474433a 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/1.1.sql @@ -107,6 +107,102 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table migtest_e_test_binary ( + id integer generated by default as identity not null, + test_byte16 varbinary(16), + test_byte256 varbinary(256), + test_byte512 varbinary(512), + test_byte1k varbinary(1024), + test_byte2k varbinary(2048), + test_byte4k varbinary(4096), + test_byte8k blob(8192), + test_byte16k blob(16384), + test_byte32k blob(32768), + test_byte64k blob(65536), + test_byte128k blob(131072), + test_byte256k blob(262144), + test_byte512k blob(524288), + test_byte1m blob(1048576), + test_byte2m blob(2097152), + test_byte4m blob(4194304), + test_byte8m blob(8388608), + test_byte16m blob(16777216), + test_byte32m blob(33554432), + constraint pk_migtest_e_test_binary primary key (id) +); + +create table migtest_e_test_json ( + id integer generated by default as identity not null, + json255 varchar(255), + json256 varchar(256), + json512 varchar(512), + json1k varchar(1024), + json2k varchar(2048), + json4k clob(4096), + json8k clob(8192), + json16k clob(16384), + json32k clob(32768), + json64k clob(65536), + json128k clob(131072), + json256k clob(262144), + json512k clob(524288), + json1m clob(1048576), + json2m clob(2097152), + json4m clob(4194304), + json8m clob(8388608), + json16m clob(16777216), + json32m clob(33554432), + constraint pk_migtest_e_test_json primary key (id) +); + +create table migtest_e_test_lob ( + id integer generated by default as identity not null, + lob255 clob, + lob256 clob, + lob512 clob, + lob1k clob, + lob2k clob, + lob4k clob, + lob8k clob, + lob16k clob, + lob32k clob, + lob64k clob, + lob128k clob, + lob256k clob, + lob512k clob, + lob1m clob, + lob2m clob, + lob4m clob, + lob8m clob, + lob16m clob, + lob32m clob, + constraint pk_migtest_e_test_lob primary key (id) +); + +create table migtest_e_test_varchar ( + id integer generated by default as identity not null, + varchar255 varchar(255), + varchar256 varchar(256), + varchar512 varchar(512), + varchar1k varchar(1024), + varchar2k varchar(2048), + varchar4k clob(4096), + varchar8k clob(8192), + varchar16k clob(16384), + varchar32k clob(32768), + varchar64k clob(65536), + varchar128k clob(131072), + varchar256k clob(262144), + varchar512k clob(524288), + varchar1m clob(1048576), + varchar2m clob(2097152), + varchar4m clob(4194304), + varchar8m clob(8388608), + varchar16m clob(16777216), + varchar32m clob(33554432), + constraint pk_migtest_e_test_varchar primary key (id) +); + create table migtest_e_user ( id integer generated by default as identity not null, constraint pk_migtest_e_user primary key (id) diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/1.4__dropsFor_1.3.sql index c2a60415ab..38f8b7c59f 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/1.4__dropsFor_1.3.sql @@ -73,6 +73,38 @@ if exists (select seqschema from syscat.sequences where seqschema = current_sche execute stmt; end if; end$$; +drop table migtest_e_test_binary; +delimiter $$ +begin +if exists (select seqschema from syscat.sequences where seqschema = current_schema and ucase(seqname) = 'MIGTEST_E_TEST_BINARY_SEQ') then + prepare stmt from 'drop sequence migtest_e_test_binary_seq'; + execute stmt; +end if; +end$$; +drop table migtest_e_test_json; +delimiter $$ +begin +if exists (select seqschema from syscat.sequences where seqschema = current_schema and ucase(seqname) = 'MIGTEST_E_TEST_JSON_SEQ') then + prepare stmt from 'drop sequence migtest_e_test_json_seq'; + execute stmt; +end if; +end$$; +drop table migtest_e_test_lob; +delimiter $$ +begin +if exists (select seqschema from syscat.sequences where seqschema = current_schema and ucase(seqname) = 'MIGTEST_E_TEST_LOB_SEQ') then + prepare stmt from 'drop sequence migtest_e_test_lob_seq'; + execute stmt; +end if; +end$$; +drop table migtest_e_test_varchar; +delimiter $$ +begin +if exists (select seqschema from syscat.sequences where seqschema = current_schema and ucase(seqname) = 'MIGTEST_E_TEST_VARCHAR_SEQ') then + prepare stmt from 'drop sequence migtest_e_test_varchar_seq'; + execute stmt; +end if; +end$$; drop table migtest_e_user; delimiter $$ begin diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/idx_db2.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/idx_db2.migrations index 9938d1f0bb..e080749fad 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/idx_db2.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/idx_db2.migrations @@ -1,7 +1,7 @@ -1467839063, 1.0__initial.sql -300902032, 1.1.sql +1392865974, 1.1.sql -1187336846, 1.2__dropsFor_1.1.sql -1811865535, 1.3.sql --1255430844, 1.4__dropsFor_1.3.sql +1864105401, 1.4__dropsFor_1.3.sql 561281075, R__order_views.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/1.1.sql index e17bc6574e..08008a18ad 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/1.1.sql @@ -33,6 +33,102 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table migtest_e_test_binary ( + id integer auto_increment not null, + test_byte16 varbinary(16), + test_byte256 varbinary(256), + test_byte512 varbinary(512), + test_byte1k varbinary(1024), + test_byte2k varbinary(2048), + test_byte4k varbinary(4096), + test_byte8k varbinary(8192), + test_byte16k varbinary(16384), + test_byte32k varbinary(32768), + test_byte64k varbinary(65536), + test_byte128k varbinary(131072), + test_byte256k varbinary(262144), + test_byte512k varbinary(524288), + test_byte1m varbinary(1048576), + test_byte2m varbinary(2097152), + test_byte4m varbinary(4194304), + test_byte8m varbinary(8388608), + test_byte16m varbinary(16777216), + test_byte32m varbinary(33554432), + constraint pk_migtest_e_test_binary primary key (id) +); + +create table migtest_e_test_json ( + id integer auto_increment not null, + json255 varchar(255), + json256 varchar(256), + json512 varchar(512), + json1k varchar(1024), + json2k varchar(2048), + json4k varchar(4096), + json8k varchar(8192), + json16k varchar(16384), + json32k varchar(32768), + json64k varchar(65536), + json128k varchar(131072), + json256k varchar(262144), + json512k varchar(524288), + json1m varchar(1048576), + json2m varchar(2097152), + json4m varchar(4194304), + json8m varchar(8388608), + json16m varchar(16777216), + json32m varchar(33554432), + constraint pk_migtest_e_test_json primary key (id) +); + +create table migtest_e_test_lob ( + id integer auto_increment not null, + lob255 clob, + lob256 clob, + lob512 clob, + lob1k clob, + lob2k clob, + lob4k clob, + lob8k clob, + lob16k clob, + lob32k clob, + lob64k clob, + lob128k clob, + lob256k clob, + lob512k clob, + lob1m clob, + lob2m clob, + lob4m clob, + lob8m clob, + lob16m clob, + lob32m clob, + constraint pk_migtest_e_test_lob primary key (id) +); + +create table migtest_e_test_varchar ( + id integer auto_increment not null, + varchar255 varchar(255), + varchar256 varchar(256), + varchar512 varchar(512), + varchar1k varchar(1024), + varchar2k varchar(2048), + varchar4k varchar(4096), + varchar8k varchar(8192), + varchar16k varchar(16384), + varchar32k varchar(32768), + varchar64k varchar(65536), + varchar128k varchar(131072), + varchar256k varchar(262144), + varchar512k varchar(524288), + varchar1m varchar(1048576), + varchar2m varchar(2097152), + varchar4m varchar(4194304), + varchar8m varchar(8388608), + varchar16m varchar(16777216), + varchar32m varchar(33554432), + constraint pk_migtest_e_test_varchar primary key (id) +); + create table migtest_e_user ( id integer auto_increment not null, constraint pk_migtest_e_user primary key (id) diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/1.4__dropsFor_1.3.sql index 52fd62211c..d66b81f566 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/1.4__dropsFor_1.3.sql @@ -21,6 +21,10 @@ drop table if exists drop_main; drop table if exists drop_main_drop_ref_many; drop table if exists drop_ref_many; drop table if exists drop_ref_one; +drop table if exists migtest_e_test_binary; +drop table if exists migtest_e_test_json; +drop table if exists migtest_e_test_lob; +drop table if exists migtest_e_test_varchar; drop table if exists migtest_e_user; drop table if exists migtest_mtm_c_migtest_mtm_m; drop table if exists migtest_mtm_m_migtest_mtm_c; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/idx_generic.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/idx_generic.migrations index 348be53923..4adfd909a7 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/idx_generic.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/idx_generic.migrations @@ -1,6 +1,6 @@ -1547037623, 1.0__initial.sql -647357251, 1.1.sql +275373095, 1.1.sql 688811494, 1.2__dropsFor_1.1.sql 674925120, 1.3.sql -677297367, 1.4__dropsFor_1.3.sql +-252580551, 1.4__dropsFor_1.3.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/1.1.sql index adc9f49a6f..be023a9def 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/1.1.sql @@ -107,6 +107,102 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table migtest_e_test_binary ( + id integer generated by default as identity not null, + test_byte16 varbinary(16), + test_byte256 varbinary(256), + test_byte512 varbinary(512), + test_byte1k varbinary(1024), + test_byte2k varbinary(2048), + test_byte4k varbinary(4096), + test_byte8k blob(8192), + test_byte16k blob(16384), + test_byte32k blob(32768), + test_byte64k blob(65536), + test_byte128k blob(131072), + test_byte256k blob(262144), + test_byte512k blob(524288), + test_byte1m blob(1048576), + test_byte2m blob(2097152), + test_byte4m blob(4194304), + test_byte8m blob(8388608), + test_byte16m blob(16777216), + test_byte32m blob(33554432), + constraint pk_migtest_e_test_binary primary key (id) +); + +create table migtest_e_test_json ( + id integer generated by default as identity not null, + json255 varchar(255), + json256 varchar(256), + json512 varchar(512), + json1k varchar(1024), + json2k varchar(2048), + json4k clob(4096), + json8k clob(8192), + json16k clob(16384), + json32k clob(32768), + json64k clob(65536), + json128k clob(131072), + json256k clob(262144), + json512k clob(524288), + json1m clob(1048576), + json2m clob(2097152), + json4m clob(4194304), + json8m clob(8388608), + json16m clob(16777216), + json32m clob(33554432), + constraint pk_migtest_e_test_json primary key (id) +); + +create table migtest_e_test_lob ( + id integer generated by default as identity not null, + lob255 clob, + lob256 clob, + lob512 clob, + lob1k clob, + lob2k clob, + lob4k clob, + lob8k clob, + lob16k clob, + lob32k clob, + lob64k clob, + lob128k clob, + lob256k clob, + lob512k clob, + lob1m clob, + lob2m clob, + lob4m clob, + lob8m clob, + lob16m clob, + lob32m clob, + constraint pk_migtest_e_test_lob primary key (id) +); + +create table migtest_e_test_varchar ( + id integer generated by default as identity not null, + varchar255 varchar(255), + varchar256 varchar(256), + varchar512 varchar(512), + varchar1k varchar(1024), + varchar2k varchar(2048), + varchar4k clob(4096), + varchar8k clob(8192), + varchar16k clob(16384), + varchar32k clob(32768), + varchar64k clob(65536), + varchar128k clob(131072), + varchar256k clob(262144), + varchar512k clob(524288), + varchar1m clob(1048576), + varchar2m clob(2097152), + varchar4m clob(4194304), + varchar8m clob(8388608), + varchar16m clob(16777216), + varchar32m clob(33554432), + constraint pk_migtest_e_test_varchar primary key (id) +); + create table migtest_e_user ( id integer generated by default as identity not null, constraint pk_migtest_e_user primary key (id) diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/1.4__dropsFor_1.3.sql index c2a60415ab..38f8b7c59f 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/1.4__dropsFor_1.3.sql @@ -73,6 +73,38 @@ if exists (select seqschema from syscat.sequences where seqschema = current_sche execute stmt; end if; end$$; +drop table migtest_e_test_binary; +delimiter $$ +begin +if exists (select seqschema from syscat.sequences where seqschema = current_schema and ucase(seqname) = 'MIGTEST_E_TEST_BINARY_SEQ') then + prepare stmt from 'drop sequence migtest_e_test_binary_seq'; + execute stmt; +end if; +end$$; +drop table migtest_e_test_json; +delimiter $$ +begin +if exists (select seqschema from syscat.sequences where seqschema = current_schema and ucase(seqname) = 'MIGTEST_E_TEST_JSON_SEQ') then + prepare stmt from 'drop sequence migtest_e_test_json_seq'; + execute stmt; +end if; +end$$; +drop table migtest_e_test_lob; +delimiter $$ +begin +if exists (select seqschema from syscat.sequences where seqschema = current_schema and ucase(seqname) = 'MIGTEST_E_TEST_LOB_SEQ') then + prepare stmt from 'drop sequence migtest_e_test_lob_seq'; + execute stmt; +end if; +end$$; +drop table migtest_e_test_varchar; +delimiter $$ +begin +if exists (select seqschema from syscat.sequences where seqschema = current_schema and ucase(seqname) = 'MIGTEST_E_TEST_VARCHAR_SEQ') then + prepare stmt from 'drop sequence migtest_e_test_varchar_seq'; + execute stmt; +end if; +end$$; drop table migtest_e_user; delimiter $$ begin diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/idx_db2.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/idx_db2.migrations index 8b86013679..c2926700d6 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/idx_db2.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/idx_db2.migrations @@ -1,8 +1,8 @@ 1307787475, I__create_tablespaces.sql 2058232717, 1.0__initial.sql -1290834425, 1.1.sql +372361421, 1.1.sql -1187336846, 1.2__dropsFor_1.1.sql 469192394, 1.3.sql --1255430844, 1.4__dropsFor_1.3.sql +1864105401, 1.4__dropsFor_1.3.sql 561281075, R__order_views.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/1.1.sql index adc9f49a6f..be023a9def 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/1.1.sql @@ -107,6 +107,102 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table migtest_e_test_binary ( + id integer generated by default as identity not null, + test_byte16 varbinary(16), + test_byte256 varbinary(256), + test_byte512 varbinary(512), + test_byte1k varbinary(1024), + test_byte2k varbinary(2048), + test_byte4k varbinary(4096), + test_byte8k blob(8192), + test_byte16k blob(16384), + test_byte32k blob(32768), + test_byte64k blob(65536), + test_byte128k blob(131072), + test_byte256k blob(262144), + test_byte512k blob(524288), + test_byte1m blob(1048576), + test_byte2m blob(2097152), + test_byte4m blob(4194304), + test_byte8m blob(8388608), + test_byte16m blob(16777216), + test_byte32m blob(33554432), + constraint pk_migtest_e_test_binary primary key (id) +); + +create table migtest_e_test_json ( + id integer generated by default as identity not null, + json255 varchar(255), + json256 varchar(256), + json512 varchar(512), + json1k varchar(1024), + json2k varchar(2048), + json4k clob(4096), + json8k clob(8192), + json16k clob(16384), + json32k clob(32768), + json64k clob(65536), + json128k clob(131072), + json256k clob(262144), + json512k clob(524288), + json1m clob(1048576), + json2m clob(2097152), + json4m clob(4194304), + json8m clob(8388608), + json16m clob(16777216), + json32m clob(33554432), + constraint pk_migtest_e_test_json primary key (id) +); + +create table migtest_e_test_lob ( + id integer generated by default as identity not null, + lob255 clob, + lob256 clob, + lob512 clob, + lob1k clob, + lob2k clob, + lob4k clob, + lob8k clob, + lob16k clob, + lob32k clob, + lob64k clob, + lob128k clob, + lob256k clob, + lob512k clob, + lob1m clob, + lob2m clob, + lob4m clob, + lob8m clob, + lob16m clob, + lob32m clob, + constraint pk_migtest_e_test_lob primary key (id) +); + +create table migtest_e_test_varchar ( + id integer generated by default as identity not null, + varchar255 varchar(255), + varchar256 varchar(256), + varchar512 varchar(512), + varchar1k varchar(1024), + varchar2k varchar(2048), + varchar4k clob(4096), + varchar8k clob(8192), + varchar16k clob(16384), + varchar32k clob(32768), + varchar64k clob(65536), + varchar128k clob(131072), + varchar256k clob(262144), + varchar512k clob(524288), + varchar1m clob(1048576), + varchar2m clob(2097152), + varchar4m clob(4194304), + varchar8m clob(8388608), + varchar16m clob(16777216), + varchar32m clob(33554432), + constraint pk_migtest_e_test_varchar primary key (id) +); + create table migtest_e_user ( id integer generated by default as identity not null, constraint pk_migtest_e_user primary key (id) diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/1.4__dropsFor_1.3.sql index c2a60415ab..38f8b7c59f 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/1.4__dropsFor_1.3.sql @@ -73,6 +73,38 @@ if exists (select seqschema from syscat.sequences where seqschema = current_sche execute stmt; end if; end$$; +drop table migtest_e_test_binary; +delimiter $$ +begin +if exists (select seqschema from syscat.sequences where seqschema = current_schema and ucase(seqname) = 'MIGTEST_E_TEST_BINARY_SEQ') then + prepare stmt from 'drop sequence migtest_e_test_binary_seq'; + execute stmt; +end if; +end$$; +drop table migtest_e_test_json; +delimiter $$ +begin +if exists (select seqschema from syscat.sequences where seqschema = current_schema and ucase(seqname) = 'MIGTEST_E_TEST_JSON_SEQ') then + prepare stmt from 'drop sequence migtest_e_test_json_seq'; + execute stmt; +end if; +end$$; +drop table migtest_e_test_lob; +delimiter $$ +begin +if exists (select seqschema from syscat.sequences where seqschema = current_schema and ucase(seqname) = 'MIGTEST_E_TEST_LOB_SEQ') then + prepare stmt from 'drop sequence migtest_e_test_lob_seq'; + execute stmt; +end if; +end$$; +drop table migtest_e_test_varchar; +delimiter $$ +begin +if exists (select seqschema from syscat.sequences where seqschema = current_schema and ucase(seqname) = 'MIGTEST_E_TEST_VARCHAR_SEQ') then + prepare stmt from 'drop sequence migtest_e_test_varchar_seq'; + execute stmt; +end if; +end$$; drop table migtest_e_user; delimiter $$ begin diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/idx_db2.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/idx_db2.migrations index e23deaabf2..930929aa3a 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/idx_db2.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/idx_db2.migrations @@ -1,7 +1,7 @@ 2058232717, 1.0__initial.sql -1290834425, 1.1.sql +372361421, 1.1.sql -1187336846, 1.2__dropsFor_1.1.sql 469192394, 1.3.sql --1255430844, 1.4__dropsFor_1.3.sql +1864105401, 1.4__dropsFor_1.3.sql 561281075, R__order_views.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/generic/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/generic/1.1.sql index e17bc6574e..08008a18ad 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/generic/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/generic/1.1.sql @@ -33,6 +33,102 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table migtest_e_test_binary ( + id integer auto_increment not null, + test_byte16 varbinary(16), + test_byte256 varbinary(256), + test_byte512 varbinary(512), + test_byte1k varbinary(1024), + test_byte2k varbinary(2048), + test_byte4k varbinary(4096), + test_byte8k varbinary(8192), + test_byte16k varbinary(16384), + test_byte32k varbinary(32768), + test_byte64k varbinary(65536), + test_byte128k varbinary(131072), + test_byte256k varbinary(262144), + test_byte512k varbinary(524288), + test_byte1m varbinary(1048576), + test_byte2m varbinary(2097152), + test_byte4m varbinary(4194304), + test_byte8m varbinary(8388608), + test_byte16m varbinary(16777216), + test_byte32m varbinary(33554432), + constraint pk_migtest_e_test_binary primary key (id) +); + +create table migtest_e_test_json ( + id integer auto_increment not null, + json255 varchar(255), + json256 varchar(256), + json512 varchar(512), + json1k varchar(1024), + json2k varchar(2048), + json4k varchar(4096), + json8k varchar(8192), + json16k varchar(16384), + json32k varchar(32768), + json64k varchar(65536), + json128k varchar(131072), + json256k varchar(262144), + json512k varchar(524288), + json1m varchar(1048576), + json2m varchar(2097152), + json4m varchar(4194304), + json8m varchar(8388608), + json16m varchar(16777216), + json32m varchar(33554432), + constraint pk_migtest_e_test_json primary key (id) +); + +create table migtest_e_test_lob ( + id integer auto_increment not null, + lob255 clob, + lob256 clob, + lob512 clob, + lob1k clob, + lob2k clob, + lob4k clob, + lob8k clob, + lob16k clob, + lob32k clob, + lob64k clob, + lob128k clob, + lob256k clob, + lob512k clob, + lob1m clob, + lob2m clob, + lob4m clob, + lob8m clob, + lob16m clob, + lob32m clob, + constraint pk_migtest_e_test_lob primary key (id) +); + +create table migtest_e_test_varchar ( + id integer auto_increment not null, + varchar255 varchar(255), + varchar256 varchar(256), + varchar512 varchar(512), + varchar1k varchar(1024), + varchar2k varchar(2048), + varchar4k varchar(4096), + varchar8k varchar(8192), + varchar16k varchar(16384), + varchar32k varchar(32768), + varchar64k varchar(65536), + varchar128k varchar(131072), + varchar256k varchar(262144), + varchar512k varchar(524288), + varchar1m varchar(1048576), + varchar2m varchar(2097152), + varchar4m varchar(4194304), + varchar8m varchar(8388608), + varchar16m varchar(16777216), + varchar32m varchar(33554432), + constraint pk_migtest_e_test_varchar primary key (id) +); + create table migtest_e_user ( id integer auto_increment not null, constraint pk_migtest_e_user primary key (id) diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/generic/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/generic/1.4__dropsFor_1.3.sql index 52fd62211c..d66b81f566 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/generic/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/generic/1.4__dropsFor_1.3.sql @@ -21,6 +21,10 @@ drop table if exists drop_main; drop table if exists drop_main_drop_ref_many; drop table if exists drop_ref_many; drop table if exists drop_ref_one; +drop table if exists migtest_e_test_binary; +drop table if exists migtest_e_test_json; +drop table if exists migtest_e_test_lob; +drop table if exists migtest_e_test_varchar; drop table if exists migtest_e_user; drop table if exists migtest_mtm_c_migtest_mtm_m; drop table if exists migtest_mtm_m_migtest_mtm_c; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/generic/idx_generic.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/generic/idx_generic.migrations index 348be53923..4adfd909a7 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/generic/idx_generic.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/generic/idx_generic.migrations @@ -1,6 +1,6 @@ -1547037623, 1.0__initial.sql -647357251, 1.1.sql +275373095, 1.1.sql 688811494, 1.2__dropsFor_1.1.sql 674925120, 1.3.sql -677297367, 1.4__dropsFor_1.3.sql +-252580551, 1.4__dropsFor_1.3.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/h2/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/h2/1.1.sql index beeec16ed9..5b15b853f5 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/h2/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/h2/1.1.sql @@ -33,6 +33,102 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table migtest_e_test_binary ( + id integer generated by default as identity not null, + test_byte16 varbinary(16), + test_byte256 varbinary(256), + test_byte512 varbinary(512), + test_byte1k varbinary(1024), + test_byte2k varbinary(2048), + test_byte4k varbinary(4096), + test_byte8k varbinary(8192), + test_byte16k varbinary(16384), + test_byte32k varbinary(32768), + test_byte64k varbinary(65536), + test_byte128k varbinary(131072), + test_byte256k varbinary(262144), + test_byte512k varbinary(524288), + test_byte1m varbinary(1048576), + test_byte2m varbinary(2097152), + test_byte4m varbinary(4194304), + test_byte8m varbinary(8388608), + test_byte16m varbinary(16777216), + test_byte32m varbinary(33554432), + constraint pk_migtest_e_test_binary primary key (id) +); + +create table migtest_e_test_json ( + id integer generated by default as identity not null, + json255 varchar(255), + json256 varchar(256), + json512 varchar(512), + json1k varchar(1024), + json2k varchar(2048), + json4k varchar(4096), + json8k varchar(8192), + json16k varchar(16384), + json32k varchar(32768), + json64k varchar(65536), + json128k varchar(131072), + json256k varchar(262144), + json512k varchar(524288), + json1m varchar(1048576), + json2m varchar(2097152), + json4m varchar(4194304), + json8m varchar(8388608), + json16m varchar(16777216), + json32m varchar(33554432), + constraint pk_migtest_e_test_json primary key (id) +); + +create table migtest_e_test_lob ( + id integer generated by default as identity not null, + lob255 clob, + lob256 clob, + lob512 clob, + lob1k clob, + lob2k clob, + lob4k clob, + lob8k clob, + lob16k clob, + lob32k clob, + lob64k clob, + lob128k clob, + lob256k clob, + lob512k clob, + lob1m clob, + lob2m clob, + lob4m clob, + lob8m clob, + lob16m clob, + lob32m clob, + constraint pk_migtest_e_test_lob primary key (id) +); + +create table migtest_e_test_varchar ( + id integer generated by default as identity not null, + varchar255 varchar(255), + varchar256 varchar(256), + varchar512 varchar(512), + varchar1k varchar(1024), + varchar2k varchar(2048), + varchar4k varchar(4096), + varchar8k varchar(8192), + varchar16k varchar(16384), + varchar32k varchar(32768), + varchar64k varchar(65536), + varchar128k varchar(131072), + varchar256k varchar(262144), + varchar512k varchar(524288), + varchar1m varchar(1048576), + varchar2m varchar(2097152), + varchar4m varchar(4194304), + varchar8m varchar(8388608), + varchar16m varchar(16777216), + varchar32m varchar(33554432), + constraint pk_migtest_e_test_varchar primary key (id) +); + create table migtest_e_user ( id integer generated by default as identity not null, constraint pk_migtest_e_user primary key (id) diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/h2/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/h2/1.4__dropsFor_1.3.sql index 475ab0a4c8..7dd46268ac 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/h2/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/h2/1.4__dropsFor_1.3.sql @@ -50,6 +50,14 @@ drop table if exists drop_ref_many; drop sequence if exists drop_ref_many_seq; drop table if exists drop_ref_one; drop sequence if exists drop_ref_one_seq; +drop table if exists migtest_e_test_binary; +drop sequence if exists migtest_e_test_binary_seq; +drop table if exists migtest_e_test_json; +drop sequence if exists migtest_e_test_json_seq; +drop table if exists migtest_e_test_lob; +drop sequence if exists migtest_e_test_lob_seq; +drop table if exists migtest_e_test_varchar; +drop sequence if exists migtest_e_test_varchar_seq; drop table if exists migtest_e_user; drop sequence if exists migtest_e_user_seq; drop table if exists migtest_mtm_c_migtest_mtm_m; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/h2/idx_h2.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/h2/idx_h2.migrations index d5a6d57126..1a613da0d4 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/h2/idx_h2.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/h2/idx_h2.migrations @@ -1,8 +1,8 @@ -1854589550, 1.0__initial.sql --298026519, 1.1.sql +-505431855, 1.1.sql 1579867974, 1.2__dropsFor_1.1.sql 64466326, 1.3.sql -255910011, 1.4__dropsFor_1.3.sql +-232694612, 1.4__dropsFor_1.3.sql 783227075, R__multi_comments.sql 561281075, R__order_views.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/hana/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/hana/1.1.sql index 47adc66fa6..84800ffc76 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/hana/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/hana/1.1.sql @@ -81,6 +81,102 @@ create column table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create column table migtest_e_test_binary ( + id integer generated by default as identity not null, + test_byte16 varbinary(16), + test_byte256 varbinary(256), + test_byte512 varbinary(512), + test_byte1k varbinary(1024), + test_byte2k varbinary(2048), + test_byte4k varbinary(4096), + test_byte8k blob, + test_byte16k blob, + test_byte32k blob, + test_byte64k blob, + test_byte128k blob, + test_byte256k blob, + test_byte512k blob, + test_byte1m blob, + test_byte2m blob, + test_byte4m blob, + test_byte8m blob, + test_byte16m blob, + test_byte32m blob, + constraint pk_migtest_e_test_binary primary key (id) +); + +create column table migtest_e_test_json ( + id integer generated by default as identity not null, + json255 nvarchar(255), + json256 nvarchar(256), + json512 nvarchar(512), + json1k nvarchar(1024), + json2k nvarchar(2048), + json4k nvarchar(4096), + json8k nclob, + json16k nclob, + json32k nclob, + json64k nclob, + json128k nclob, + json256k nclob, + json512k nclob, + json1m nclob, + json2m nclob, + json4m nclob, + json8m nclob, + json16m nclob, + json32m nclob, + constraint pk_migtest_e_test_json primary key (id) +); + +create column table migtest_e_test_lob ( + id integer generated by default as identity not null, + lob255 nclob, + lob256 nclob, + lob512 nclob, + lob1k nclob, + lob2k nclob, + lob4k nclob, + lob8k nclob, + lob16k nclob, + lob32k nclob, + lob64k nclob, + lob128k nclob, + lob256k nclob, + lob512k nclob, + lob1m nclob, + lob2m nclob, + lob4m nclob, + lob8m nclob, + lob16m nclob, + lob32m nclob, + constraint pk_migtest_e_test_lob primary key (id) +); + +create column table migtest_e_test_varchar ( + id integer generated by default as identity not null, + varchar255 nvarchar(255), + varchar256 nvarchar(256), + varchar512 nvarchar(512), + varchar1k nvarchar(1024), + varchar2k nvarchar(2048), + varchar4k nvarchar(4096), + varchar8k nclob, + varchar16k nclob, + varchar32k nclob, + varchar64k nclob, + varchar128k nclob, + varchar256k nclob, + varchar512k nclob, + varchar1m nclob, + varchar2m nclob, + varchar4m nclob, + varchar8m nclob, + varchar16m nclob, + varchar32m nclob, + constraint pk_migtest_e_test_varchar primary key (id) +); + create column table migtest_e_user ( id integer generated by default as identity not null, constraint pk_migtest_e_user primary key (id) diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/hana/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/hana/1.4__dropsFor_1.3.sql index caee68f0e0..ba054e40e7 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/hana/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/hana/1.4__dropsFor_1.3.sql @@ -39,6 +39,10 @@ drop table drop_main cascade; drop table drop_main_drop_ref_many cascade; drop table drop_ref_many cascade; drop table drop_ref_one cascade; +drop table migtest_e_test_binary cascade; +drop table migtest_e_test_json cascade; +drop table migtest_e_test_lob cascade; +drop table migtest_e_test_varchar cascade; drop table migtest_e_user cascade; drop table migtest_mtm_c_migtest_mtm_m cascade; drop table migtest_mtm_m_migtest_mtm_c cascade; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/hana/idx_hana.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/hana/idx_hana.migrations index 00547d47bf..8250815092 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/hana/idx_hana.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/hana/idx_hana.migrations @@ -1,8 +1,8 @@ -745347271, I__create_procs.sql -2017770851, 1.0__initial.sql -1261740376, 1.1.sql +2126049978, 1.1.sql 1535221752, 1.2__dropsFor_1.1.sql 1459381570, 1.3.sql -1163601680, 1.4__dropsFor_1.3.sql +-490709749, 1.4__dropsFor_1.3.sql 1906063401, R__order_views_hana.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/hsqldb/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/hsqldb/1.1.sql index c07a9e9a22..db5e03b994 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/hsqldb/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/hsqldb/1.1.sql @@ -33,6 +33,102 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table migtest_e_test_binary ( + id integer generated by default as identity (start with 1) not null, + test_byte16 varbinary(16), + test_byte256 varbinary(256), + test_byte512 varbinary(512), + test_byte1k varbinary(1024), + test_byte2k varbinary(2048), + test_byte4k varbinary(4096), + test_byte8k varbinary(8192), + test_byte16k varbinary(16384), + test_byte32k varbinary(32768), + test_byte64k varbinary(65536), + test_byte128k varbinary(131072), + test_byte256k varbinary(262144), + test_byte512k varbinary(524288), + test_byte1m varbinary(1048576), + test_byte2m varbinary(2097152), + test_byte4m varbinary(4194304), + test_byte8m varbinary(8388608), + test_byte16m varbinary(16777216), + test_byte32m varbinary(33554432), + constraint pk_migtest_e_test_binary primary key (id) +); + +create table migtest_e_test_json ( + id integer generated by default as identity (start with 1) not null, + json255 varchar(255), + json256 varchar(256), + json512 varchar(512), + json1k varchar(1024), + json2k varchar(2048), + json4k varchar(4096), + json8k varchar(8192), + json16k varchar(16384), + json32k varchar(32768), + json64k varchar(65536), + json128k varchar(131072), + json256k varchar(262144), + json512k varchar(524288), + json1m varchar(1048576), + json2m varchar(2097152), + json4m varchar(4194304), + json8m varchar(8388608), + json16m varchar(16777216), + json32m varchar(33554432), + constraint pk_migtest_e_test_json primary key (id) +); + +create table migtest_e_test_lob ( + id integer generated by default as identity (start with 1) not null, + lob255 clob, + lob256 clob, + lob512 clob, + lob1k clob, + lob2k clob, + lob4k clob, + lob8k clob, + lob16k clob, + lob32k clob, + lob64k clob, + lob128k clob, + lob256k clob, + lob512k clob, + lob1m clob, + lob2m clob, + lob4m clob, + lob8m clob, + lob16m clob, + lob32m clob, + constraint pk_migtest_e_test_lob primary key (id) +); + +create table migtest_e_test_varchar ( + id integer generated by default as identity (start with 1) not null, + varchar255 varchar(255), + varchar256 varchar(256), + varchar512 varchar(512), + varchar1k varchar(1024), + varchar2k varchar(2048), + varchar4k varchar(4096), + varchar8k varchar(8192), + varchar16k varchar(16384), + varchar32k varchar(32768), + varchar64k varchar(65536), + varchar128k varchar(131072), + varchar256k varchar(262144), + varchar512k varchar(524288), + varchar1m varchar(1048576), + varchar2m varchar(2097152), + varchar4m varchar(4194304), + varchar8m varchar(8388608), + varchar16m varchar(16777216), + varchar32m varchar(33554432), + constraint pk_migtest_e_test_varchar primary key (id) +); + create table migtest_e_user ( id integer generated by default as identity (start with 1) not null, constraint pk_migtest_e_user primary key (id) diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/hsqldb/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/hsqldb/1.4__dropsFor_1.3.sql index b47c0901d8..42ed7a01d4 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/hsqldb/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/hsqldb/1.4__dropsFor_1.3.sql @@ -24,6 +24,14 @@ drop table if exists drop_ref_many; drop sequence if exists drop_ref_many_seq; drop table if exists drop_ref_one; drop sequence if exists drop_ref_one_seq; +drop table if exists migtest_e_test_binary; +drop sequence if exists migtest_e_test_binary_seq; +drop table if exists migtest_e_test_json; +drop sequence if exists migtest_e_test_json_seq; +drop table if exists migtest_e_test_lob; +drop sequence if exists migtest_e_test_lob_seq; +drop table if exists migtest_e_test_varchar; +drop sequence if exists migtest_e_test_varchar_seq; drop table if exists migtest_e_user; drop sequence if exists migtest_e_user_seq; drop table if exists migtest_mtm_c_migtest_mtm_m; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/hsqldb/idx_hsqldb.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/hsqldb/idx_hsqldb.migrations index cdc9da585b..f8ca1056cb 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/hsqldb/idx_hsqldb.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/hsqldb/idx_hsqldb.migrations @@ -1,7 +1,7 @@ 1833930558, 1.0__initial.sql --1636879297, 1.1.sql +-432003541, 1.1.sql -848622216, 1.2__dropsFor_1.1.sql -1921508585, 1.3.sql -1870787524, 1.4__dropsFor_1.3.sql +-1547659386, 1.4__dropsFor_1.3.sql 861001272, R__order_views_hsqldb.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.1.sql index 10dc07db1d..13a754cea6 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.1.sql @@ -30,6 +30,102 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table migtest_e_test_binary ( + id integer auto_increment not null, + test_byte16 varbinary(16), + test_byte256 varbinary(256), + test_byte512 varbinary(512), + test_byte1k varbinary(1024), + test_byte2k varbinary(2048), + test_byte4k varbinary(4096), + test_byte8k blob, + test_byte16k blob, + test_byte32k blob, + test_byte64k mediumblob, + test_byte128k mediumblob, + test_byte256k mediumblob, + test_byte512k mediumblob, + test_byte1m mediumblob, + test_byte2m mediumblob, + test_byte4m mediumblob, + test_byte8m mediumblob, + test_byte16m longblob, + test_byte32m longblob, + constraint pk_migtest_e_test_binary primary key (id) +); + +create table migtest_e_test_json ( + id integer auto_increment not null, + json255 json, + json256 json, + json512 json, + json1k json, + json2k json, + json4k json, + json8k json, + json16k json, + json32k json, + json64k json, + json128k json, + json256k json, + json512k json, + json1m json, + json2m json, + json4m json, + json8m json, + json16m json, + json32m json, + constraint pk_migtest_e_test_json primary key (id) +); + +create table migtest_e_test_lob ( + id integer auto_increment not null, + lob255 longtext, + lob256 longtext, + lob512 longtext, + lob1k longtext, + lob2k longtext, + lob4k longtext, + lob8k longtext, + lob16k longtext, + lob32k longtext, + lob64k longtext, + lob128k longtext, + lob256k longtext, + lob512k longtext, + lob1m longtext, + lob2m longtext, + lob4m longtext, + lob8m longtext, + lob16m longtext, + lob32m longtext, + constraint pk_migtest_e_test_lob primary key (id) +); + +create table migtest_e_test_varchar ( + id integer auto_increment not null, + varchar255 varchar(255), + varchar256 varchar(256), + varchar512 varchar(512), + varchar1k varchar(1024), + varchar2k varchar(2048), + varchar4k text, + varchar8k varchar(8193), + varchar16k text, + varchar32k text, + varchar64k mediumtext, + varchar128k mediumtext, + varchar256k mediumtext, + varchar512k mediumtext, + varchar1m mediumtext, + varchar2m mediumtext, + varchar4m mediumtext, + varchar8m mediumtext, + varchar16m longtext, + varchar32m longtext, + constraint pk_migtest_e_test_varchar primary key (id) +); + create table migtest_e_user ( id integer auto_increment not null, constraint pk_migtest_e_user primary key (id) diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.4__dropsFor_1.3.sql index 4fecc1a2c2..81e4368e28 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.4__dropsFor_1.3.sql @@ -27,6 +27,14 @@ drop table if exists drop_ref_many; drop sequence if exists drop_ref_many_seq; drop table if exists drop_ref_one; drop sequence if exists drop_ref_one_seq; +drop table if exists migtest_e_test_binary; +drop sequence if exists migtest_e_test_binary_seq; +drop table if exists migtest_e_test_json; +drop sequence if exists migtest_e_test_json_seq; +drop table if exists migtest_e_test_lob; +drop sequence if exists migtest_e_test_lob_seq; +drop table if exists migtest_e_test_varchar; +drop sequence if exists migtest_e_test_varchar_seq; drop table if exists migtest_e_user; drop sequence if exists migtest_e_user_seq; drop table if exists migtest_mtm_c_migtest_mtm_m; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/idx_mariadb.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/idx_mariadb.migrations index 0e7ac7e89c..09c4f565f8 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/idx_mariadb.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/idx_mariadb.migrations @@ -1,7 +1,7 @@ -2111548334, 1.0__initial.sql --359661866, 1.1.sql +1717242095, 1.1.sql 919151678, 1.2__dropsFor_1.1.sql -413458006, 1.3.sql --1557805741, 1.4__dropsFor_1.3.sql +-177212756, 1.4__dropsFor_1.3.sql 561281075, R__order_views.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.1.sql index 10dc07db1d..13a754cea6 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.1.sql @@ -30,6 +30,102 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table migtest_e_test_binary ( + id integer auto_increment not null, + test_byte16 varbinary(16), + test_byte256 varbinary(256), + test_byte512 varbinary(512), + test_byte1k varbinary(1024), + test_byte2k varbinary(2048), + test_byte4k varbinary(4096), + test_byte8k blob, + test_byte16k blob, + test_byte32k blob, + test_byte64k mediumblob, + test_byte128k mediumblob, + test_byte256k mediumblob, + test_byte512k mediumblob, + test_byte1m mediumblob, + test_byte2m mediumblob, + test_byte4m mediumblob, + test_byte8m mediumblob, + test_byte16m longblob, + test_byte32m longblob, + constraint pk_migtest_e_test_binary primary key (id) +); + +create table migtest_e_test_json ( + id integer auto_increment not null, + json255 json, + json256 json, + json512 json, + json1k json, + json2k json, + json4k json, + json8k json, + json16k json, + json32k json, + json64k json, + json128k json, + json256k json, + json512k json, + json1m json, + json2m json, + json4m json, + json8m json, + json16m json, + json32m json, + constraint pk_migtest_e_test_json primary key (id) +); + +create table migtest_e_test_lob ( + id integer auto_increment not null, + lob255 longtext, + lob256 longtext, + lob512 longtext, + lob1k longtext, + lob2k longtext, + lob4k longtext, + lob8k longtext, + lob16k longtext, + lob32k longtext, + lob64k longtext, + lob128k longtext, + lob256k longtext, + lob512k longtext, + lob1m longtext, + lob2m longtext, + lob4m longtext, + lob8m longtext, + lob16m longtext, + lob32m longtext, + constraint pk_migtest_e_test_lob primary key (id) +); + +create table migtest_e_test_varchar ( + id integer auto_increment not null, + varchar255 varchar(255), + varchar256 varchar(256), + varchar512 varchar(512), + varchar1k varchar(1024), + varchar2k varchar(2048), + varchar4k text, + varchar8k varchar(8193), + varchar16k text, + varchar32k text, + varchar64k mediumtext, + varchar128k mediumtext, + varchar256k mediumtext, + varchar512k mediumtext, + varchar1m mediumtext, + varchar2m mediumtext, + varchar4m mediumtext, + varchar8m mediumtext, + varchar16m longtext, + varchar32m longtext, + constraint pk_migtest_e_test_varchar primary key (id) +); + create table migtest_e_user ( id integer auto_increment not null, constraint pk_migtest_e_user primary key (id) diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.4__dropsFor_1.3.sql index e2f75756a7..2e57704e8d 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.4__dropsFor_1.3.sql @@ -27,6 +27,14 @@ drop table if exists drop_ref_many; drop sequence if exists drop_ref_many_seq; drop table if exists drop_ref_one; drop sequence if exists drop_ref_one_seq; +drop table if exists migtest_e_test_binary; +drop sequence if exists migtest_e_test_binary_seq; +drop table if exists migtest_e_test_json; +drop sequence if exists migtest_e_test_json_seq; +drop table if exists migtest_e_test_lob; +drop sequence if exists migtest_e_test_lob_seq; +drop table if exists migtest_e_test_varchar; +drop sequence if exists migtest_e_test_varchar_seq; drop table if exists migtest_e_user; drop sequence if exists migtest_e_user_seq; drop table if exists migtest_mtm_c_migtest_mtm_m; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/idx_mariadb.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/idx_mariadb.migrations index e7b3da9273..784e32fd0f 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/idx_mariadb.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/idx_mariadb.migrations @@ -1,8 +1,8 @@ -1933396282, I__create_procs.sql -2111548334, 1.0__initial.sql --359661866, 1.1.sql +1717242095, 1.1.sql 1187950993, 1.2__dropsFor_1.1.sql -413458006, 1.3.sql --430651388, 1.4__dropsFor_1.3.sql +-1494509099, 1.4__dropsFor_1.3.sql 561281075, R__order_views.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.1.model.xml b/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.1.model.xml index e6f43d0f5d..d23d982eed 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.1.model.xml +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.1.model.xml @@ -95,6 +95,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.3.model.xml b/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.3.model.xml index 2041a1131e..bd902b3172 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.3.model.xml +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.3.model.xml @@ -94,6 +94,10 @@ + + + + diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.4__dropsFor_1.3.model.xml b/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.4__dropsFor_1.3.model.xml index 160798377b..84b6f2c41e 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.4__dropsFor_1.3.model.xml +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.4__dropsFor_1.3.model.xml @@ -22,6 +22,10 @@ + + + + diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/1.1.sql index ef94068578..2107234400 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/1.1.sql @@ -30,6 +30,102 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table migtest_e_test_binary ( + id integer auto_increment not null, + test_byte16 varbinary(16), + test_byte256 varbinary(256), + test_byte512 varbinary(512), + test_byte1k varbinary(1024), + test_byte2k varbinary(2048), + test_byte4k varbinary(4096), + test_byte8k blob, + test_byte16k blob, + test_byte32k blob, + test_byte64k mediumblob, + test_byte128k mediumblob, + test_byte256k mediumblob, + test_byte512k mediumblob, + test_byte1m mediumblob, + test_byte2m mediumblob, + test_byte4m mediumblob, + test_byte8m mediumblob, + test_byte16m longblob, + test_byte32m longblob, + constraint pk_migtest_e_test_binary primary key (id) +); + +create table migtest_e_test_json ( + id integer auto_increment not null, + json255 json, + json256 json, + json512 json, + json1k json, + json2k json, + json4k json, + json8k json, + json16k json, + json32k json, + json64k json, + json128k json, + json256k json, + json512k json, + json1m json, + json2m json, + json4m json, + json8m json, + json16m json, + json32m json, + constraint pk_migtest_e_test_json primary key (id) +); + +create table migtest_e_test_lob ( + id integer auto_increment not null, + lob255 longtext, + lob256 longtext, + lob512 longtext, + lob1k longtext, + lob2k longtext, + lob4k longtext, + lob8k longtext, + lob16k longtext, + lob32k longtext, + lob64k longtext, + lob128k longtext, + lob256k longtext, + lob512k longtext, + lob1m longtext, + lob2m longtext, + lob4m longtext, + lob8m longtext, + lob16m longtext, + lob32m longtext, + constraint pk_migtest_e_test_lob primary key (id) +); + +create table migtest_e_test_varchar ( + id integer auto_increment not null, + varchar255 varchar(255), + varchar256 varchar(256), + varchar512 varchar(512), + varchar1k varchar(1024), + varchar2k varchar(2048), + varchar4k text, + varchar8k varchar(8193), + varchar16k text, + varchar32k text, + varchar64k mediumtext, + varchar128k mediumtext, + varchar256k mediumtext, + varchar512k mediumtext, + varchar1m mediumtext, + varchar2m mediumtext, + varchar4m mediumtext, + varchar8m mediumtext, + varchar16m longtext, + varchar32m longtext, + constraint pk_migtest_e_test_varchar primary key (id) +); + create table migtest_e_user ( id integer auto_increment not null, constraint pk_migtest_e_user primary key (id) diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/1.4__dropsFor_1.3.sql index 73da644e8e..02bf03425d 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/1.4__dropsFor_1.3.sql @@ -81,6 +81,10 @@ drop table if exists drop_main; drop table if exists drop_main_drop_ref_many; drop table if exists drop_ref_many; drop table if exists drop_ref_one; +drop table if exists migtest_e_test_binary; +drop table if exists migtest_e_test_json; +drop table if exists migtest_e_test_lob; +drop table if exists migtest_e_test_varchar; drop table if exists migtest_e_user; drop table if exists migtest_mtm_c_migtest_mtm_m; drop table if exists migtest_mtm_m_migtest_mtm_c; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/idx_mysql.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/idx_mysql.migrations index 5f73a85469..84edad9993 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/idx_mysql.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/idx_mysql.migrations @@ -1,8 +1,8 @@ -1933396282, I__create_procs.sql 1980830787, 1.0__initial.sql --868893802, 1.1.sql +-847541300, 1.1.sql -1097227916, 1.2__dropsFor_1.1.sql 141196883, 1.3.sql -1435550240, 1.4__dropsFor_1.3.sql +1044119359, 1.4__dropsFor_1.3.sql 561281075, R__order_views.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/1.1.sql index ef94068578..2107234400 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/1.1.sql @@ -30,6 +30,102 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table migtest_e_test_binary ( + id integer auto_increment not null, + test_byte16 varbinary(16), + test_byte256 varbinary(256), + test_byte512 varbinary(512), + test_byte1k varbinary(1024), + test_byte2k varbinary(2048), + test_byte4k varbinary(4096), + test_byte8k blob, + test_byte16k blob, + test_byte32k blob, + test_byte64k mediumblob, + test_byte128k mediumblob, + test_byte256k mediumblob, + test_byte512k mediumblob, + test_byte1m mediumblob, + test_byte2m mediumblob, + test_byte4m mediumblob, + test_byte8m mediumblob, + test_byte16m longblob, + test_byte32m longblob, + constraint pk_migtest_e_test_binary primary key (id) +); + +create table migtest_e_test_json ( + id integer auto_increment not null, + json255 json, + json256 json, + json512 json, + json1k json, + json2k json, + json4k json, + json8k json, + json16k json, + json32k json, + json64k json, + json128k json, + json256k json, + json512k json, + json1m json, + json2m json, + json4m json, + json8m json, + json16m json, + json32m json, + constraint pk_migtest_e_test_json primary key (id) +); + +create table migtest_e_test_lob ( + id integer auto_increment not null, + lob255 longtext, + lob256 longtext, + lob512 longtext, + lob1k longtext, + lob2k longtext, + lob4k longtext, + lob8k longtext, + lob16k longtext, + lob32k longtext, + lob64k longtext, + lob128k longtext, + lob256k longtext, + lob512k longtext, + lob1m longtext, + lob2m longtext, + lob4m longtext, + lob8m longtext, + lob16m longtext, + lob32m longtext, + constraint pk_migtest_e_test_lob primary key (id) +); + +create table migtest_e_test_varchar ( + id integer auto_increment not null, + varchar255 varchar(255), + varchar256 varchar(256), + varchar512 varchar(512), + varchar1k varchar(1024), + varchar2k varchar(2048), + varchar4k text, + varchar8k varchar(8193), + varchar16k text, + varchar32k text, + varchar64k mediumtext, + varchar128k mediumtext, + varchar256k mediumtext, + varchar512k mediumtext, + varchar1m mediumtext, + varchar2m mediumtext, + varchar4m mediumtext, + varchar8m mediumtext, + varchar16m longtext, + varchar32m longtext, + constraint pk_migtest_e_test_varchar primary key (id) +); + create table migtest_e_user ( id integer auto_increment not null, constraint pk_migtest_e_user primary key (id) diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/1.4__dropsFor_1.3.sql index 73da644e8e..02bf03425d 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/1.4__dropsFor_1.3.sql @@ -81,6 +81,10 @@ drop table if exists drop_main; drop table if exists drop_main_drop_ref_many; drop table if exists drop_ref_many; drop table if exists drop_ref_one; +drop table if exists migtest_e_test_binary; +drop table if exists migtest_e_test_json; +drop table if exists migtest_e_test_lob; +drop table if exists migtest_e_test_varchar; drop table if exists migtest_e_user; drop table if exists migtest_mtm_c_migtest_mtm_m; drop table if exists migtest_mtm_m_migtest_mtm_c; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/idx_mysql.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/idx_mysql.migrations index d224e3a0dc..69f8a03176 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/idx_mysql.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/idx_mysql.migrations @@ -1,8 +1,8 @@ -1933396282, I__create_procs.sql 369577572, 1.0__initial.sql --868893802, 1.1.sql +-847541300, 1.1.sql -1097227916, 1.2__dropsFor_1.1.sql 141196883, 1.3.sql -1435550240, 1.4__dropsFor_1.3.sql +1044119359, 1.4__dropsFor_1.3.sql 561281075, R__order_views.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/nuodb/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/nuodb/1.1.sql index 62b1c58372..b1e603bc79 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/nuodb/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/nuodb/1.1.sql @@ -33,6 +33,102 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table migtest_e_test_binary ( + id integer generated by default as identity not null, + test_byte16 varbinary(16), + test_byte256 varbinary(256), + test_byte512 varbinary(512), + test_byte1k varbinary(1024), + test_byte2k varbinary(2048), + test_byte4k blob, + test_byte8k blob, + test_byte16k blob, + test_byte32k blob, + test_byte64k blob, + test_byte128k blob, + test_byte256k blob, + test_byte512k blob, + test_byte1m blob, + test_byte2m blob, + test_byte4m blob, + test_byte8m blob, + test_byte16m blob, + test_byte32m blob, + constraint pk_migtest_e_test_binary primary key (id) +); + +create table migtest_e_test_json ( + id integer generated by default as identity not null, + json255 varchar(255), + json256 varchar(256), + json512 varchar(512), + json1k varchar(1024), + json2k varchar(2048), + json4k clob, + json8k clob, + json16k clob, + json32k clob, + json64k clob, + json128k clob, + json256k clob, + json512k clob, + json1m clob, + json2m clob, + json4m clob, + json8m clob, + json16m clob, + json32m clob, + constraint pk_migtest_e_test_json primary key (id) +); + +create table migtest_e_test_lob ( + id integer generated by default as identity not null, + lob255 clob, + lob256 clob, + lob512 clob, + lob1k clob, + lob2k clob, + lob4k clob, + lob8k clob, + lob16k clob, + lob32k clob, + lob64k clob, + lob128k clob, + lob256k clob, + lob512k clob, + lob1m clob, + lob2m clob, + lob4m clob, + lob8m clob, + lob16m clob, + lob32m clob, + constraint pk_migtest_e_test_lob primary key (id) +); + +create table migtest_e_test_varchar ( + id integer generated by default as identity not null, + varchar255 varchar(255), + varchar256 varchar(256), + varchar512 varchar(512), + varchar1k varchar(1024), + varchar2k varchar(2048), + varchar4k clob, + varchar8k clob, + varchar16k clob, + varchar32k clob, + varchar64k clob, + varchar128k clob, + varchar256k clob, + varchar512k clob, + varchar1m clob, + varchar2m clob, + varchar4m clob, + varchar8m clob, + varchar16m clob, + varchar32m clob, + constraint pk_migtest_e_test_varchar primary key (id) +); + create table migtest_e_user ( id integer generated by default as identity not null, constraint pk_migtest_e_user primary key (id) diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/nuodb/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/nuodb/1.4__dropsFor_1.3.sql index 5a8e4a8142..1eda038675 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/nuodb/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/nuodb/1.4__dropsFor_1.3.sql @@ -90,6 +90,14 @@ drop table if exists drop_ref_many; drop sequence if exists drop_ref_many_seq; drop table if exists drop_ref_one; drop sequence if exists drop_ref_one_seq; +drop table if exists migtest_e_test_binary; +drop sequence if exists migtest_e_test_binary_seq; +drop table if exists migtest_e_test_json; +drop sequence if exists migtest_e_test_json_seq; +drop table if exists migtest_e_test_lob; +drop sequence if exists migtest_e_test_lob_seq; +drop table if exists migtest_e_test_varchar; +drop sequence if exists migtest_e_test_varchar_seq; drop table if exists migtest_e_user; drop sequence if exists migtest_e_user_seq; drop table if exists migtest_mtm_c_migtest_mtm_m; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/nuodb/idx_nuodb.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/nuodb/idx_nuodb.migrations index be14e7cfd1..85b584cd46 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/nuodb/idx_nuodb.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/nuodb/idx_nuodb.migrations @@ -1,7 +1,7 @@ 390216918, 1.0__initial.sql -1677721520, 1.1.sql +-303196611, 1.1.sql 1530685455, 1.2__dropsFor_1.1.sql -956168377, 1.3.sql -146295108, 1.4__dropsFor_1.3.sql +1047623430, 1.4__dropsFor_1.3.sql 561281075, R__order_views.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/oracle/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/oracle/1.1.sql index fc3569c81b..c222cc8a51 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/oracle/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/oracle/1.1.sql @@ -78,6 +78,102 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table migtest_e_test_binary ( + id number(10) generated by default as identity not null, + test_byte16 raw(16), + test_byte256 raw(256), + test_byte512 raw(512), + test_byte1k raw(1024), + test_byte2k blob, + test_byte4k blob, + test_byte8k blob, + test_byte16k blob, + test_byte32k blob, + test_byte64k blob, + test_byte128k blob, + test_byte256k blob, + test_byte512k blob, + test_byte1m blob, + test_byte2m blob, + test_byte4m blob, + test_byte8m blob, + test_byte16m blob, + test_byte32m blob, + constraint pk_migtest_e_test_binary primary key (id) +); + +create table migtest_e_test_json ( + id number(10) generated by default as identity not null, + json255 varchar2(255), + json256 varchar2(256), + json512 varchar2(512), + json1k varchar2(1024), + json2k varchar2(2048), + json4k clob, + json8k clob, + json16k clob, + json32k clob, + json64k clob, + json128k clob, + json256k clob, + json512k clob, + json1m clob, + json2m clob, + json4m clob, + json8m clob, + json16m clob, + json32m clob, + constraint pk_migtest_e_test_json primary key (id) +); + +create table migtest_e_test_lob ( + id number(10) generated by default as identity not null, + lob255 clob, + lob256 clob, + lob512 clob, + lob1k clob, + lob2k clob, + lob4k clob, + lob8k clob, + lob16k clob, + lob32k clob, + lob64k clob, + lob128k clob, + lob256k clob, + lob512k clob, + lob1m clob, + lob2m clob, + lob4m clob, + lob8m clob, + lob16m clob, + lob32m clob, + constraint pk_migtest_e_test_lob primary key (id) +); + +create table migtest_e_test_varchar ( + id number(10) generated by default as identity not null, + varchar255 varchar2(255), + varchar256 varchar2(256), + varchar512 varchar2(512), + varchar1k varchar2(1024), + varchar2k varchar2(2048), + varchar4k clob, + varchar8k clob, + varchar16k clob, + varchar32k clob, + varchar64k clob, + varchar128k clob, + varchar256k clob, + varchar512k clob, + varchar1m clob, + varchar2m clob, + varchar4m clob, + varchar8m clob, + varchar16m clob, + varchar32m clob, + constraint pk_migtest_e_test_varchar primary key (id) +); + create table migtest_e_user ( id number(10) generated by default as identity not null, constraint pk_migtest_e_user primary key (id) diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/oracle/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/oracle/1.4__dropsFor_1.3.sql index 01046ec495..2a70d52110 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/oracle/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/oracle/1.4__dropsFor_1.3.sql @@ -51,6 +51,50 @@ exception when expected_error then null; end; $$; +drop table migtest_e_test_binary cascade constraints purge; +delimiter $$ +declare + expected_error exception; + pragma exception_init(expected_error, -2289); +begin + execute immediate 'drop sequence migtest_e_test_binary_seq'; +exception + when expected_error then null; +end; +$$; +drop table migtest_e_test_json cascade constraints purge; +delimiter $$ +declare + expected_error exception; + pragma exception_init(expected_error, -2289); +begin + execute immediate 'drop sequence migtest_e_test_json_seq'; +exception + when expected_error then null; +end; +$$; +drop table migtest_e_test_lob cascade constraints purge; +delimiter $$ +declare + expected_error exception; + pragma exception_init(expected_error, -2289); +begin + execute immediate 'drop sequence migtest_e_test_lob_seq'; +exception + when expected_error then null; +end; +$$; +drop table migtest_e_test_varchar cascade constraints purge; +delimiter $$ +declare + expected_error exception; + pragma exception_init(expected_error, -2289); +begin + execute immediate 'drop sequence migtest_e_test_varchar_seq'; +exception + when expected_error then null; +end; +$$; drop table migtest_e_user cascade constraints purge; delimiter $$ declare diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/oracle/idx_oracle.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/oracle/idx_oracle.migrations index ad1f33d3f8..7aff21509a 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/oracle/idx_oracle.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/oracle/idx_oracle.migrations @@ -1,8 +1,8 @@ 1757923548, 1.0__initial.sql --425348886, 1.1.sql +-1862781653, 1.1.sql 930172034, 1.2__dropsFor_1.1.sql -647790612, 1.3.sql -1707389466, 1.4__dropsFor_1.3.sql +-116456403, 1.4__dropsFor_1.3.sql 1357801733, R__oracle_only_views.sql 561281075, R__order_views.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/oracle11/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/oracle11/1.1.sql index bd6c098dca..59d29e6499 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/oracle11/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/oracle11/1.1.sql @@ -81,6 +81,106 @@ create table drop_ref_one ( ); create sequence drop_ref_one_seq; +create table migtest_e_test_binary ( + id number(10) not null, + test_byte16 raw(16), + test_byte256 raw(256), + test_byte512 raw(512), + test_byte1k raw(1024), + test_byte2k blob, + test_byte4k blob, + test_byte8k blob, + test_byte16k blob, + test_byte32k blob, + test_byte64k blob, + test_byte128k blob, + test_byte256k blob, + test_byte512k blob, + test_byte1m blob, + test_byte2m blob, + test_byte4m blob, + test_byte8m blob, + test_byte16m blob, + test_byte32m blob, + constraint pk_migtest_e_test_binary primary key (id) +); +create sequence migtest_e_test_binary_seq; + +create table migtest_e_test_json ( + id number(10) not null, + json255 varchar2(255), + json256 varchar2(256), + json512 varchar2(512), + json1k varchar2(1024), + json2k varchar2(2048), + json4k clob, + json8k clob, + json16k clob, + json32k clob, + json64k clob, + json128k clob, + json256k clob, + json512k clob, + json1m clob, + json2m clob, + json4m clob, + json8m clob, + json16m clob, + json32m clob, + constraint pk_migtest_e_test_json primary key (id) +); +create sequence migtest_e_test_json_seq; + +create table migtest_e_test_lob ( + id number(10) not null, + lob255 clob, + lob256 clob, + lob512 clob, + lob1k clob, + lob2k clob, + lob4k clob, + lob8k clob, + lob16k clob, + lob32k clob, + lob64k clob, + lob128k clob, + lob256k clob, + lob512k clob, + lob1m clob, + lob2m clob, + lob4m clob, + lob8m clob, + lob16m clob, + lob32m clob, + constraint pk_migtest_e_test_lob primary key (id) +); +create sequence migtest_e_test_lob_seq; + +create table migtest_e_test_varchar ( + id number(10) not null, + varchar255 varchar2(255), + varchar256 varchar2(256), + varchar512 varchar2(512), + varchar1k varchar2(1024), + varchar2k varchar2(2048), + varchar4k clob, + varchar8k clob, + varchar16k clob, + varchar32k clob, + varchar64k clob, + varchar128k clob, + varchar256k clob, + varchar512k clob, + varchar1m clob, + varchar2m clob, + varchar4m clob, + varchar8m clob, + varchar16m clob, + varchar32m clob, + constraint pk_migtest_e_test_varchar primary key (id) +); +create sequence migtest_e_test_varchar_seq; + create table migtest_e_user ( id number(10) not null, constraint pk_migtest_e_user primary key (id) diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/oracle11/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/oracle11/1.4__dropsFor_1.3.sql index 01046ec495..2a70d52110 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/oracle11/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/oracle11/1.4__dropsFor_1.3.sql @@ -51,6 +51,50 @@ exception when expected_error then null; end; $$; +drop table migtest_e_test_binary cascade constraints purge; +delimiter $$ +declare + expected_error exception; + pragma exception_init(expected_error, -2289); +begin + execute immediate 'drop sequence migtest_e_test_binary_seq'; +exception + when expected_error then null; +end; +$$; +drop table migtest_e_test_json cascade constraints purge; +delimiter $$ +declare + expected_error exception; + pragma exception_init(expected_error, -2289); +begin + execute immediate 'drop sequence migtest_e_test_json_seq'; +exception + when expected_error then null; +end; +$$; +drop table migtest_e_test_lob cascade constraints purge; +delimiter $$ +declare + expected_error exception; + pragma exception_init(expected_error, -2289); +begin + execute immediate 'drop sequence migtest_e_test_lob_seq'; +exception + when expected_error then null; +end; +$$; +drop table migtest_e_test_varchar cascade constraints purge; +delimiter $$ +declare + expected_error exception; + pragma exception_init(expected_error, -2289); +begin + execute immediate 'drop sequence migtest_e_test_varchar_seq'; +exception + when expected_error then null; +end; +$$; drop table migtest_e_user cascade constraints purge; delimiter $$ declare diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/oracle11/idx_oracle.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/oracle11/idx_oracle.migrations index 5edc1625ac..e1d314b8c0 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/oracle11/idx_oracle.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/oracle11/idx_oracle.migrations @@ -1,8 +1,8 @@ -1422254768, 1.0__initial.sql -1978733753, 1.1.sql +661141209, 1.1.sql 930172034, 1.2__dropsFor_1.1.sql 1369863782, 1.3.sql -1707389466, 1.4__dropsFor_1.3.sql +-116456403, 1.4__dropsFor_1.3.sql 1357801733, R__oracle_only_views.sql 561281075, R__order_views.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.1.sql index aadfbb8b76..e116daeced 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.1.sql @@ -36,6 +36,102 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table migtest_e_test_binary ( + id integer generated by default as identity not null, + test_byte16 bytea, + test_byte256 bytea, + test_byte512 bytea, + test_byte1k bytea, + test_byte2k bytea, + test_byte4k bytea, + test_byte8k bytea, + test_byte16k bytea, + test_byte32k bytea, + test_byte64k bytea, + test_byte128k bytea, + test_byte256k bytea, + test_byte512k bytea, + test_byte1m bytea, + test_byte2m bytea, + test_byte4m bytea, + test_byte8m bytea, + test_byte16m bytea, + test_byte32m bytea, + constraint pk_migtest_e_test_binary primary key (id) +); + +create table migtest_e_test_json ( + id integer generated by default as identity not null, + json255 json, + json256 json, + json512 json, + json1k json, + json2k json, + json4k json, + json8k json, + json16k json, + json32k json, + json64k json, + json128k json, + json256k json, + json512k json, + json1m json, + json2m json, + json4m json, + json8m json, + json16m json, + json32m json, + constraint pk_migtest_e_test_json primary key (id) +); + +create table migtest_e_test_lob ( + id integer generated by default as identity not null, + lob255 text, + lob256 text, + lob512 text, + lob1k text, + lob2k text, + lob4k text, + lob8k text, + lob16k text, + lob32k text, + lob64k text, + lob128k text, + lob256k text, + lob512k text, + lob1m text, + lob2m text, + lob4m text, + lob8m text, + lob16m text, + lob32m text, + constraint pk_migtest_e_test_lob primary key (id) +); + +create table migtest_e_test_varchar ( + id integer generated by default as identity not null, + varchar8k varchar(8192), + varchar255 varchar(255), + varchar256 varchar(256), + varchar512 varchar(512), + varchar1k varchar(1024), + varchar2k varchar(2048), + varchar4k varchar(4096), + varchar16k varchar(16384), + varchar32k varchar(32768), + varchar64k varchar(65536), + varchar128k varchar(131072), + varchar256k varchar(262144), + varchar512k varchar(524288), + varchar1m varchar(1048576), + varchar2m varchar(2097152), + varchar4m varchar(4194304), + varchar8m varchar(8388608), + varchar16m text, + varchar32m text, + constraint pk_migtest_e_test_varchar primary key (id) +); + create table migtest_e_user ( id integer generated by default as identity not null, constraint pk_migtest_e_user primary key (id) diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.4__dropsFor_1.3.sql index 4920137107..28f59c8e6e 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.4__dropsFor_1.3.sql @@ -120,6 +120,14 @@ drop table if exists drop_ref_many cascade; drop sequence if exists drop_ref_many_seq; drop table if exists drop_ref_one cascade; drop sequence if exists drop_ref_one_seq; +drop table if exists migtest_e_test_binary cascade; +drop sequence if exists migtest_e_test_binary_seq; +drop table if exists migtest_e_test_json cascade; +drop sequence if exists migtest_e_test_json_seq; +drop table if exists migtest_e_test_lob cascade; +drop sequence if exists migtest_e_test_lob_seq; +drop table if exists migtest_e_test_varchar cascade; +drop sequence if exists migtest_e_test_varchar_seq; drop table if exists migtest_e_user cascade; drop sequence if exists migtest_e_user_seq; drop table if exists migtest_mtm_c_migtest_mtm_m cascade; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/idx_postgres.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/idx_postgres.migrations index 0f5fc0b20e..b919977c38 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/idx_postgres.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/idx_postgres.migrations @@ -1,8 +1,8 @@ 1942370812, 1.0__initial.sql -106674126, 1.1.sql +-150823045, 1.1.sql -261111052, 1.2__dropsFor_1.1.sql 788727457, 1.3.sql --596521697, 1.4__dropsFor_1.3.sql +-1352224731, 1.4__dropsFor_1.3.sql 783227075, R__multi_comments.sql 561281075, R__order_views.sql 283077354, R__pg_indexes.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.1.sql index 6a33648b13..dd0d1827c3 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.1.sql @@ -36,6 +36,102 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table migtest_e_test_binary ( + id serial not null, + test_byte16 bytea, + test_byte256 bytea, + test_byte512 bytea, + test_byte1k bytea, + test_byte2k bytea, + test_byte4k bytea, + test_byte8k bytea, + test_byte16k bytea, + test_byte32k bytea, + test_byte64k bytea, + test_byte128k bytea, + test_byte256k bytea, + test_byte512k bytea, + test_byte1m bytea, + test_byte2m bytea, + test_byte4m bytea, + test_byte8m bytea, + test_byte16m bytea, + test_byte32m bytea, + constraint pk_migtest_e_test_binary primary key (id) +); + +create table migtest_e_test_json ( + id serial not null, + json255 json, + json256 json, + json512 json, + json1k json, + json2k json, + json4k json, + json8k json, + json16k json, + json32k json, + json64k json, + json128k json, + json256k json, + json512k json, + json1m json, + json2m json, + json4m json, + json8m json, + json16m json, + json32m json, + constraint pk_migtest_e_test_json primary key (id) +); + +create table migtest_e_test_lob ( + id serial not null, + lob255 text, + lob256 text, + lob512 text, + lob1k text, + lob2k text, + lob4k text, + lob8k text, + lob16k text, + lob32k text, + lob64k text, + lob128k text, + lob256k text, + lob512k text, + lob1m text, + lob2m text, + lob4m text, + lob8m text, + lob16m text, + lob32m text, + constraint pk_migtest_e_test_lob primary key (id) +); + +create table migtest_e_test_varchar ( + id serial not null, + varchar8k varchar(8192), + varchar255 varchar(255), + varchar256 varchar(256), + varchar512 varchar(512), + varchar1k varchar(1024), + varchar2k varchar(2048), + varchar4k varchar(4096), + varchar16k varchar(16384), + varchar32k varchar(32768), + varchar64k varchar(65536), + varchar128k varchar(131072), + varchar256k varchar(262144), + varchar512k varchar(524288), + varchar1m varchar(1048576), + varchar2m varchar(2097152), + varchar4m varchar(4194304), + varchar8m varchar(8388608), + varchar16m text, + varchar32m text, + constraint pk_migtest_e_test_varchar primary key (id) +); + create table migtest_e_user ( id serial not null, constraint pk_migtest_e_user primary key (id) diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.4__dropsFor_1.3.sql index 4920137107..28f59c8e6e 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.4__dropsFor_1.3.sql @@ -120,6 +120,14 @@ drop table if exists drop_ref_many cascade; drop sequence if exists drop_ref_many_seq; drop table if exists drop_ref_one cascade; drop sequence if exists drop_ref_one_seq; +drop table if exists migtest_e_test_binary cascade; +drop sequence if exists migtest_e_test_binary_seq; +drop table if exists migtest_e_test_json cascade; +drop sequence if exists migtest_e_test_json_seq; +drop table if exists migtest_e_test_lob cascade; +drop sequence if exists migtest_e_test_lob_seq; +drop table if exists migtest_e_test_varchar cascade; +drop sequence if exists migtest_e_test_varchar_seq; drop table if exists migtest_e_user cascade; drop sequence if exists migtest_e_user_seq; drop table if exists migtest_mtm_c_migtest_mtm_m cascade; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/idx_postgres.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/idx_postgres.migrations index 1005e2e01e..e2da8048e9 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/idx_postgres.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/idx_postgres.migrations @@ -1,8 +1,8 @@ -1015076364, 1.0__initial.sql --1513219932, 1.1.sql +328269371, 1.1.sql -261111052, 1.2__dropsFor_1.1.sql -1811829200, 1.3.sql --596521697, 1.4__dropsFor_1.3.sql +-1352224731, 1.4__dropsFor_1.3.sql 783227075, R__multi_comments.sql 561281075, R__order_views.sql 283077354, R__pg_indexes.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlanywhere/1.0__initial.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlanywhere/1.0__initial.sql index 3d79a3500e..ee6f3f6a90 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlanywhere/1.0__initial.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlanywhere/1.0__initial.sql @@ -60,7 +60,7 @@ create table migtest_e_basic ( status2 varchar(1) default 'N' not null, name varchar(127), description varchar(127), - description_file binary(4500), + description_file long binary, json_list long varchar, a_lob varchar(255) default 'X' not null, some_date timestamp, diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlanywhere/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlanywhere/1.1.sql index 3b0e78e498..3383de4ad0 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlanywhere/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlanywhere/1.1.sql @@ -33,6 +33,102 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table migtest_e_test_binary ( + id integer auto_increment not null, + test_byte16 varbinary(16), + test_byte256 varbinary(256), + test_byte512 varbinary(512), + test_byte1k varbinary(1024), + test_byte2k varbinary(2048), + test_byte4k varbinary(4096), + test_byte8k varbinary(8192), + test_byte16k varbinary(16384), + test_byte32k long binary, + test_byte64k long binary, + test_byte128k long binary, + test_byte256k long binary, + test_byte512k long binary, + test_byte1m long binary, + test_byte2m long binary, + test_byte4m long binary, + test_byte8m long binary, + test_byte16m long binary, + test_byte32m long binary, + constraint pk_migtest_e_test_binary primary key (id) +); + +create table migtest_e_test_json ( + id integer auto_increment not null, + json255 varchar(255), + json256 varchar(256), + json512 varchar(512), + json1k varchar(1024), + json2k varchar(2048), + json4k varchar(4096), + json8k varchar(8192), + json16k varchar(16384), + json32k long varchar, + json64k long varchar, + json128k long varchar, + json256k long varchar, + json512k long varchar, + json1m long varchar, + json2m long varchar, + json4m long varchar, + json8m long varchar, + json16m long varchar, + json32m long varchar, + constraint pk_migtest_e_test_json primary key (id) +); + +create table migtest_e_test_lob ( + id integer auto_increment not null, + lob255 long varchar, + lob256 long varchar, + lob512 long varchar, + lob1k long varchar, + lob2k long varchar, + lob4k long varchar, + lob8k long varchar, + lob16k long varchar, + lob32k long varchar, + lob64k long varchar, + lob128k long varchar, + lob256k long varchar, + lob512k long varchar, + lob1m long varchar, + lob2m long varchar, + lob4m long varchar, + lob8m long varchar, + lob16m long varchar, + lob32m long varchar, + constraint pk_migtest_e_test_lob primary key (id) +); + +create table migtest_e_test_varchar ( + id integer auto_increment not null, + varchar255 varchar(255), + varchar256 varchar(256), + varchar512 varchar(512), + varchar1k varchar(1024), + varchar2k varchar(2048), + varchar4k varchar(4096), + varchar8k varchar(8192), + varchar16k varchar(16384), + varchar32k long varchar, + varchar64k long varchar, + varchar128k long varchar, + varchar256k long varchar, + varchar512k long varchar, + varchar1m long varchar, + varchar2m long varchar, + varchar4m long varchar, + varchar8m long varchar, + varchar16m long varchar, + varchar32m long varchar, + constraint pk_migtest_e_test_varchar primary key (id) +); + create table migtest_e_user ( id integer auto_increment not null, constraint pk_migtest_e_user primary key (id) diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlanywhere/1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlanywhere/1.3.sql index 2e473b177d..6e75d1b9d7 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlanywhere/1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlanywhere/1.3.sql @@ -63,7 +63,7 @@ alter table migtest_e_basic alter column a_lob set default 'X'; alter table migtest_e_basic alter column a_lob 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 binary(4500); +alter table migtest_e_basic add column description_file long binary; alter table migtest_e_basic add column old_boolean bit default false not null; alter table migtest_e_basic add column old_boolean2 bit; alter table migtest_e_basic add column eref_id integer; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlanywhere/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlanywhere/1.4__dropsFor_1.3.sql index 52fd62211c..d66b81f566 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlanywhere/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlanywhere/1.4__dropsFor_1.3.sql @@ -21,6 +21,10 @@ drop table if exists drop_main; drop table if exists drop_main_drop_ref_many; drop table if exists drop_ref_many; drop table if exists drop_ref_one; +drop table if exists migtest_e_test_binary; +drop table if exists migtest_e_test_json; +drop table if exists migtest_e_test_lob; +drop table if exists migtest_e_test_varchar; drop table if exists migtest_e_user; drop table if exists migtest_mtm_c_migtest_mtm_m; drop table if exists migtest_mtm_m_migtest_mtm_c; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlanywhere/idx_sqlanywhere.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlanywhere/idx_sqlanywhere.migrations index 5b50f740c3..e5f698839b 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlanywhere/idx_sqlanywhere.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlanywhere/idx_sqlanywhere.migrations @@ -1,6 +1,6 @@ --951189503, 1.0__initial.sql -2050079154, 1.1.sql +-391639901, 1.0__initial.sql +974884972, 1.1.sql 688811494, 1.2__dropsFor_1.1.sql --680526370, 1.3.sql -677297367, 1.4__dropsFor_1.3.sql +1199670482, 1.3.sql +-252580551, 1.4__dropsFor_1.3.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlite/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlite/1.1.sql index f0642be0c2..0560f36e73 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlite/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlite/1.1.sql @@ -36,6 +36,102 @@ create table drop_ref_one ( foreign key (parent_id) references drop_main (id) on delete restrict on update restrict ); +create table migtest_e_test_binary ( + id integer not null, + test_byte16 varbinary(16), + test_byte256 varbinary(256), + test_byte512 varbinary(512), + test_byte1k varbinary(1024), + test_byte2k varbinary(2048), + test_byte4k varbinary(4096), + test_byte8k varbinary(8192), + test_byte16k varbinary(16384), + test_byte32k varbinary(32768), + test_byte64k varbinary(65536), + test_byte128k varbinary(131072), + test_byte256k varbinary(262144), + test_byte512k varbinary(524288), + test_byte1m varbinary(1048576), + test_byte2m varbinary(2097152), + test_byte4m varbinary(4194304), + test_byte8m varbinary(8388608), + test_byte16m varbinary(16777216), + test_byte32m varbinary(33554432), + constraint pk_migtest_e_test_binary primary key (id) +); + +create table migtest_e_test_json ( + id integer not null, + json255 varchar(255), + json256 varchar(256), + json512 varchar(512), + json1k varchar(1024), + json2k varchar(2048), + json4k varchar(4096), + json8k varchar(8192), + json16k varchar(16384), + json32k varchar(32768), + json64k varchar(65536), + json128k varchar(131072), + json256k varchar(262144), + json512k varchar(524288), + json1m varchar(1048576), + json2m varchar(2097152), + json4m varchar(4194304), + json8m varchar(8388608), + json16m varchar(16777216), + json32m varchar(33554432), + constraint pk_migtest_e_test_json primary key (id) +); + +create table migtest_e_test_lob ( + id integer not null, + lob255 clob, + lob256 clob, + lob512 clob, + lob1k clob, + lob2k clob, + lob4k clob, + lob8k clob, + lob16k clob, + lob32k clob, + lob64k clob, + lob128k clob, + lob256k clob, + lob512k clob, + lob1m clob, + lob2m clob, + lob4m clob, + lob8m clob, + lob16m clob, + lob32m clob, + constraint pk_migtest_e_test_lob primary key (id) +); + +create table migtest_e_test_varchar ( + id integer not null, + varchar255 varchar(255), + varchar256 varchar(256), + varchar512 varchar(512), + varchar1k varchar(1024), + varchar2k varchar(2048), + varchar4k varchar(4096), + varchar8k varchar(8192), + varchar16k varchar(16384), + varchar32k varchar(32768), + varchar64k varchar(65536), + varchar128k varchar(131072), + varchar256k varchar(262144), + varchar512k varchar(524288), + varchar1m varchar(1048576), + varchar2m varchar(2097152), + varchar4m varchar(4194304), + varchar8m varchar(8388608), + varchar16m varchar(16777216), + varchar32m varchar(33554432), + constraint pk_migtest_e_test_varchar primary key (id) +); + create table migtest_e_user ( id integer not null, constraint pk_migtest_e_user primary key (id) diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlite/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlite/1.4__dropsFor_1.3.sql index 52fd62211c..d66b81f566 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlite/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlite/1.4__dropsFor_1.3.sql @@ -21,6 +21,10 @@ drop table if exists drop_main; drop table if exists drop_main_drop_ref_many; drop table if exists drop_ref_many; drop table if exists drop_ref_one; +drop table if exists migtest_e_test_binary; +drop table if exists migtest_e_test_json; +drop table if exists migtest_e_test_lob; +drop table if exists migtest_e_test_varchar; drop table if exists migtest_e_user; drop table if exists migtest_mtm_c_migtest_mtm_m; drop table if exists migtest_mtm_m_migtest_mtm_c; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlite/idx_sqlite.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlite/idx_sqlite.migrations index a92a75476c..fe71e16d3c 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlite/idx_sqlite.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlite/idx_sqlite.migrations @@ -1,7 +1,7 @@ -1527127682, 1.0__initial.sql --2104033639, 1.1.sql +-321125092, 1.1.sql 688811494, 1.2__dropsFor_1.1.sql 142780650, 1.3.sql -677297367, 1.4__dropsFor_1.3.sql +-252580551, 1.4__dropsFor_1.3.sql 2034589659, R__order_views_sqlite.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/1.1.sql index 98bd0273f1..11db228e6c 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/1.1.sql @@ -35,6 +35,102 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table migtest_e_test_binary ( + id integer identity(1,1) not null, + test_byte16 image, + test_byte256 image, + test_byte512 image, + test_byte1k image, + test_byte2k image, + test_byte4k image, + test_byte8k image, + test_byte16k image, + test_byte32k image, + test_byte64k image, + test_byte128k image, + test_byte256k image, + test_byte512k image, + test_byte1m image, + test_byte2m image, + test_byte4m image, + test_byte8m image, + test_byte16m image, + test_byte32m image, + constraint pk_migtest_e_test_binary primary key (id) +); + +create table migtest_e_test_json ( + id integer identity(1,1) not null, + json255 text, + json256 text, + json512 text, + json1k text, + json2k text, + json4k text, + json8k text, + json16k text, + json32k text, + json64k text, + json128k text, + json256k text, + json512k text, + json1m text, + json2m text, + json4m text, + json8m text, + json16m text, + json32m text, + constraint pk_migtest_e_test_json primary key (id) +); + +create table migtest_e_test_lob ( + id integer identity(1,1) not null, + lob255 text, + lob256 text, + lob512 text, + lob1k text, + lob2k text, + lob4k text, + lob8k text, + lob16k text, + lob32k text, + lob64k text, + lob128k text, + lob256k text, + lob512k text, + lob1m text, + lob2m text, + lob4m text, + lob8m text, + lob16m text, + lob32m text, + constraint pk_migtest_e_test_lob primary key (id) +); + +create table migtest_e_test_varchar ( + id integer identity(1,1) not null, + varchar255 varchar(255), + varchar256 varchar(256), + varchar512 varchar(512), + varchar1k varchar(1024), + varchar2k varchar(2048), + varchar4k varchar(4096), + varchar8k text, + varchar16k text, + varchar32k text, + varchar64k text, + varchar128k text, + varchar256k text, + varchar512k text, + varchar1m text, + varchar2m text, + varchar4m text, + varchar8m text, + varchar16m text, + varchar32m text, + constraint pk_migtest_e_test_varchar primary key (id) +); + create table migtest_e_user ( id integer identity(1,1) not null, constraint pk_migtest_e_user primary key (id) diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/1.4__dropsFor_1.3.sql index 3c841d11c0..1595c2e4fb 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/1.4__dropsFor_1.3.sql @@ -43,6 +43,14 @@ IF OBJECT_ID('drop_ref_many', 'U') IS NOT NULL drop table drop_ref_many; IF OBJECT_ID('drop_ref_many_seq', 'SO') IS NOT NULL drop sequence drop_ref_many_seq; IF OBJECT_ID('drop_ref_one', 'U') IS NOT NULL drop table drop_ref_one; IF OBJECT_ID('drop_ref_one_seq', 'SO') IS NOT NULL drop sequence drop_ref_one_seq; +IF OBJECT_ID('migtest_e_test_binary', 'U') IS NOT NULL drop table migtest_e_test_binary; +IF OBJECT_ID('migtest_e_test_binary_seq', 'SO') IS NOT NULL drop sequence migtest_e_test_binary_seq; +IF OBJECT_ID('migtest_e_test_json', 'U') IS NOT NULL drop table migtest_e_test_json; +IF OBJECT_ID('migtest_e_test_json_seq', 'SO') IS NOT NULL drop sequence migtest_e_test_json_seq; +IF OBJECT_ID('migtest_e_test_lob', 'U') IS NOT NULL drop table migtest_e_test_lob; +IF OBJECT_ID('migtest_e_test_lob_seq', 'SO') IS NOT NULL drop sequence migtest_e_test_lob_seq; +IF OBJECT_ID('migtest_e_test_varchar', 'U') IS NOT NULL drop table migtest_e_test_varchar; +IF OBJECT_ID('migtest_e_test_varchar_seq', 'SO') IS NOT NULL drop sequence migtest_e_test_varchar_seq; IF OBJECT_ID('migtest_e_user', 'U') IS NOT NULL drop table migtest_e_user; IF OBJECT_ID('migtest_e_user_seq', 'SO') IS NOT NULL drop sequence migtest_e_user_seq; IF OBJECT_ID('migtest_mtm_c_migtest_mtm_m', 'U') IS NOT NULL drop table migtest_mtm_c_migtest_mtm_m; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/idx_sqlserver.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/idx_sqlserver.migrations index b835cb154c..c011a69001 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/idx_sqlserver.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/idx_sqlserver.migrations @@ -1,8 +1,8 @@ 891357544, I__create_procs.sql -1455820494, 1.0__initial.sql -2006139920, 1.1.sql +-88313995, 1.1.sql -1431095657, 1.2__dropsFor_1.1.sql 1846195516, 1.3.sql --1390979787, 1.4__dropsFor_1.3.sql +-225579996, 1.4__dropsFor_1.3.sql 1607822082, R__order_views_mssql.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/1.0__initial.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/1.0__initial.sql index 248baa6452..018755be99 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/1.0__initial.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/1.0__initial.sql @@ -68,7 +68,7 @@ create table migtest_e_basic ( status2 nvarchar(1) default 'N' not null, name nvarchar(127), description nvarchar(127), - description_file image, + description_file varbinary(max), json_list nvarchar(max), a_lob nvarchar(255) default 'X' not null, some_date datetime2, diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/1.1.sql index a10f69cf42..b79765243d 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/1.1.sql @@ -38,6 +38,106 @@ create table drop_ref_one ( ); create sequence drop_ref_one_seq as bigint start with 1; +create table migtest_e_test_binary ( + id integer not null, + test_byte16 varbinary(16), + test_byte256 varbinary(256), + test_byte512 varbinary(512), + test_byte1k varbinary(1024), + test_byte2k varbinary(2048), + test_byte4k varbinary(4096), + test_byte8k varbinary(max), + test_byte16k varbinary(max), + test_byte32k varbinary(max), + test_byte64k varbinary(max), + test_byte128k varbinary(max), + test_byte256k varbinary(max), + test_byte512k varbinary(max), + test_byte1m varbinary(max), + test_byte2m varbinary(max), + test_byte4m varbinary(max), + test_byte8m varbinary(max), + test_byte16m varbinary(max), + test_byte32m varbinary(max), + constraint pk_migtest_e_test_binary primary key (id) +); +create sequence migtest_e_test_binary_seq as bigint start with 1; + +create table migtest_e_test_json ( + id integer not null, + json255 nvarchar(255), + json256 nvarchar(256), + json512 nvarchar(512), + json1k nvarchar(1024), + json2k nvarchar(2048), + json4k nvarchar(max), + json8k nvarchar(max), + json16k nvarchar(max), + json32k nvarchar(max), + json64k nvarchar(max), + json128k nvarchar(max), + json256k nvarchar(max), + json512k nvarchar(max), + json1m nvarchar(max), + json2m nvarchar(max), + json4m nvarchar(max), + json8m nvarchar(max), + json16m nvarchar(max), + json32m nvarchar(max), + constraint pk_migtest_e_test_json primary key (id) +); +create sequence migtest_e_test_json_seq as bigint start with 1; + +create table migtest_e_test_lob ( + id integer not null, + lob255 nvarchar(max), + lob256 nvarchar(max), + lob512 nvarchar(max), + lob1k nvarchar(max), + lob2k nvarchar(max), + lob4k nvarchar(max), + lob8k nvarchar(max), + lob16k nvarchar(max), + lob32k nvarchar(max), + lob64k nvarchar(max), + lob128k nvarchar(max), + lob256k nvarchar(max), + lob512k nvarchar(max), + lob1m nvarchar(max), + lob2m nvarchar(max), + lob4m nvarchar(max), + lob8m nvarchar(max), + lob16m nvarchar(max), + lob32m nvarchar(max), + constraint pk_migtest_e_test_lob primary key (id) +); +create sequence migtest_e_test_lob_seq as bigint start with 1; + +create table migtest_e_test_varchar ( + id integer not null, + varchar255 nvarchar(255), + varchar256 nvarchar(256), + varchar512 nvarchar(512), + varchar1k nvarchar(1024), + varchar2k nvarchar(2048), + varchar4k nvarchar(max), + varchar8k nvarchar(max), + varchar16k nvarchar(max), + varchar32k nvarchar(max), + varchar64k nvarchar(max), + varchar128k nvarchar(max), + varchar256k nvarchar(max), + varchar512k nvarchar(max), + varchar1m nvarchar(max), + varchar2m nvarchar(max), + varchar4m nvarchar(max), + varchar8m nvarchar(max), + varchar16m nvarchar(max), + varchar32m nvarchar(max), + constraint pk_migtest_e_test_varchar primary key (id) +); +create sequence migtest_e_test_varchar_seq as bigint start with 1; + create table migtest_e_user ( id integer not null, constraint pk_migtest_e_user primary key (id) diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/1.3.sql index d42bcd654c..4ae8bb93c4 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/1.3.sql @@ -80,7 +80,7 @@ alter table migtest_e_basic add default 'X' for a_lob; EXEC usp_ebean_drop_default_constraint migtest_e_basic, user_id; alter table migtest_e_basic alter column user_id integer not null; alter table migtest_e_basic add default 23 for user_id; -alter table migtest_e_basic add description_file image; +alter table migtest_e_basic add description_file varbinary(max); alter table migtest_e_basic add old_boolean bit default 0 not null; alter table migtest_e_basic add old_boolean2 bit; alter table migtest_e_basic add eref_id integer; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/1.4__dropsFor_1.3.sql index 3c841d11c0..1595c2e4fb 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/1.4__dropsFor_1.3.sql @@ -43,6 +43,14 @@ IF OBJECT_ID('drop_ref_many', 'U') IS NOT NULL drop table drop_ref_many; IF OBJECT_ID('drop_ref_many_seq', 'SO') IS NOT NULL drop sequence drop_ref_many_seq; IF OBJECT_ID('drop_ref_one', 'U') IS NOT NULL drop table drop_ref_one; IF OBJECT_ID('drop_ref_one_seq', 'SO') IS NOT NULL drop sequence drop_ref_one_seq; +IF OBJECT_ID('migtest_e_test_binary', 'U') IS NOT NULL drop table migtest_e_test_binary; +IF OBJECT_ID('migtest_e_test_binary_seq', 'SO') IS NOT NULL drop sequence migtest_e_test_binary_seq; +IF OBJECT_ID('migtest_e_test_json', 'U') IS NOT NULL drop table migtest_e_test_json; +IF OBJECT_ID('migtest_e_test_json_seq', 'SO') IS NOT NULL drop sequence migtest_e_test_json_seq; +IF OBJECT_ID('migtest_e_test_lob', 'U') IS NOT NULL drop table migtest_e_test_lob; +IF OBJECT_ID('migtest_e_test_lob_seq', 'SO') IS NOT NULL drop sequence migtest_e_test_lob_seq; +IF OBJECT_ID('migtest_e_test_varchar', 'U') IS NOT NULL drop table migtest_e_test_varchar; +IF OBJECT_ID('migtest_e_test_varchar_seq', 'SO') IS NOT NULL drop sequence migtest_e_test_varchar_seq; IF OBJECT_ID('migtest_e_user', 'U') IS NOT NULL drop table migtest_e_user; IF OBJECT_ID('migtest_e_user_seq', 'SO') IS NOT NULL drop sequence migtest_e_user_seq; IF OBJECT_ID('migtest_mtm_c_migtest_mtm_m', 'U') IS NOT NULL drop table migtest_mtm_c_migtest_mtm_m; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/idx_sqlserver.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/idx_sqlserver.migrations index a1fe87d529..e843dc30d7 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/idx_sqlserver.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver17/idx_sqlserver.migrations @@ -1,8 +1,8 @@ 891357544, I__create_procs.sql -29271754, 1.0__initial.sql --449063882, 1.1.sql +1574627056, 1.0__initial.sql +1681608861, 1.1.sql -1431095657, 1.2__dropsFor_1.1.sql --1712303917, 1.3.sql --1390979787, 1.4__dropsFor_1.3.sql +486442698, 1.3.sql +-225579996, 1.4__dropsFor_1.3.sql 1607822082, R__order_views_mssql.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.1.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.1.sql index ae32ed1c43..64478fe819 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.1.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.1.sql @@ -33,6 +33,102 @@ create table drop_ref_one ( constraint pk_drop_ref_one primary key (id) ); +create table migtest_e_test_binary ( + id integer generated by default as identity not null, + test_byte16 bytea, + test_byte256 bytea, + test_byte512 bytea, + test_byte1k bytea, + test_byte2k bytea, + test_byte4k bytea, + test_byte8k bytea, + test_byte16k bytea, + test_byte32k bytea, + test_byte64k bytea, + test_byte128k bytea, + test_byte256k bytea, + test_byte512k bytea, + test_byte1m bytea, + test_byte2m bytea, + test_byte4m bytea, + test_byte8m bytea, + test_byte16m bytea, + test_byte32m bytea, + constraint pk_migtest_e_test_binary primary key (id) +); + +create table migtest_e_test_json ( + id integer generated by default as identity not null, + json255 json, + json256 json, + json512 json, + json1k json, + json2k json, + json4k json, + json8k json, + json16k json, + json32k json, + json64k json, + json128k json, + json256k json, + json512k json, + json1m json, + json2m json, + json4m json, + json8m json, + json16m json, + json32m json, + constraint pk_migtest_e_test_json primary key (id) +); + +create table migtest_e_test_lob ( + id integer generated by default as identity not null, + lob255 text, + lob256 text, + lob512 text, + lob1k text, + lob2k text, + lob4k text, + lob8k text, + lob16k text, + lob32k text, + lob64k text, + lob128k text, + lob256k text, + lob512k text, + lob1m text, + lob2m text, + lob4m text, + lob8m text, + lob16m text, + lob32m text, + constraint pk_migtest_e_test_lob primary key (id) +); + +create table migtest_e_test_varchar ( + id integer generated by default as identity not null, + varchar255 varchar(255), + varchar256 varchar(256), + varchar512 varchar(512), + varchar1k varchar(1024), + varchar2k varchar(2048), + varchar4k varchar(4096), + varchar8k varchar(8192), + varchar16k varchar(16384), + varchar32k varchar(32768), + varchar64k varchar(65536), + varchar128k varchar(131072), + varchar256k varchar(262144), + varchar512k varchar(524288), + varchar1m varchar(1048576), + varchar2m varchar(2097152), + varchar4m varchar(4194304), + varchar8m varchar(8388608), + varchar16m text, + varchar32m text, + constraint pk_migtest_e_test_varchar primary key (id) +); + create table migtest_e_user ( id integer generated by default as identity not null, constraint pk_migtest_e_user primary key (id) diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.4__dropsFor_1.3.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.4__dropsFor_1.3.sql index 4920137107..28f59c8e6e 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.4__dropsFor_1.3.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.4__dropsFor_1.3.sql @@ -120,6 +120,14 @@ drop table if exists drop_ref_many cascade; drop sequence if exists drop_ref_many_seq; drop table if exists drop_ref_one cascade; drop sequence if exists drop_ref_one_seq; +drop table if exists migtest_e_test_binary cascade; +drop sequence if exists migtest_e_test_binary_seq; +drop table if exists migtest_e_test_json cascade; +drop sequence if exists migtest_e_test_json_seq; +drop table if exists migtest_e_test_lob cascade; +drop sequence if exists migtest_e_test_lob_seq; +drop table if exists migtest_e_test_varchar cascade; +drop sequence if exists migtest_e_test_varchar_seq; drop table if exists migtest_e_user cascade; drop sequence if exists migtest_e_user_seq; drop table if exists migtest_mtm_c_migtest_mtm_m cascade; diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/idx_yugabyte.migrations b/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/idx_yugabyte.migrations index 741777201c..a5907171d8 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/idx_yugabyte.migrations +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/idx_yugabyte.migrations @@ -1,7 +1,7 @@ -1646972843, 1.0__initial.sql --1446648810, 1.1.sql +1912842724, 1.1.sql -261111052, 1.2__dropsFor_1.1.sql -526466104, 1.3.sql --596521697, 1.4__dropsFor_1.3.sql +-1352224731, 1.4__dropsFor_1.3.sql 561281075, R__order_views.sql diff --git a/platforms/clickhouse/src/main/java/io/ebean/platform/clickhouse/ClickHousePlatform.java b/platforms/clickhouse/src/main/java/io/ebean/platform/clickhouse/ClickHousePlatform.java index 32ed69ea9a..059c3281f9 100644 --- a/platforms/clickhouse/src/main/java/io/ebean/platform/clickhouse/ClickHousePlatform.java +++ b/platforms/clickhouse/src/main/java/io/ebean/platform/clickhouse/ClickHousePlatform.java @@ -45,6 +45,7 @@ public ClickHousePlatform() { dbTypeMap.put(DbType.UUID, new DbPlatformType("UUID", false)); dbTypeMap.put(DbType.INET, new DbPlatformType("String", false)); dbTypeMap.put(DbType.CIDR, new DbPlatformType("String", false)); + dbTypeMap.put(DbType.VARBINARY, new DbPlatformType("String", false)); } @Override diff --git a/platforms/db2/src/main/java/io/ebean/platform/db2/BaseDB2Platform.java b/platforms/db2/src/main/java/io/ebean/platform/db2/BaseDB2Platform.java index 57e59cfd28..ea711876e9 100644 --- a/platforms/db2/src/main/java/io/ebean/platform/db2/BaseDB2Platform.java +++ b/platforms/db2/src/main/java/io/ebean/platform/db2/BaseDB2Platform.java @@ -34,6 +34,8 @@ public BaseDB2Platform() { historySupport = new DB2HistorySupport(); booleanDbType = Types.BOOLEAN; + dbTypeMap.put(DbType.VARCHAR, new DbPlatformType("varchar", 255, 4000, dbTypeMap.get(DbType.CLOB))); + dbTypeMap.put(DbType.VARBINARY, new DbPlatformType("varbinary", 255, 8000, dbTypeMap.get(DbType.BLOB))); dbTypeMap.put(DbType.TINYINT, new DbPlatformType("smallint", false)); dbTypeMap.put(DbType.INTEGER, new DbPlatformType("integer", false)); dbTypeMap.put(DbType.BIGINT, new DbPlatformType("bigint", false)); diff --git a/platforms/hana/src/main/java/io/ebean/platform/hana/HanaPlatform.java b/platforms/hana/src/main/java/io/ebean/platform/hana/HanaPlatform.java index aa0e7b3885..39e4d034f9 100644 --- a/platforms/hana/src/main/java/io/ebean/platform/hana/HanaPlatform.java +++ b/platforms/hana/src/main/java/io/ebean/platform/hana/HanaPlatform.java @@ -34,9 +34,9 @@ public HanaPlatform() { this.dbTypeMap.put(DbType.BIGINT, new DbPlatformType("bigint", false)); this.dbTypeMap.put(DbType.BINARY, new DbPlatformType("varbinary", 255)); this.dbTypeMap.put(DbType.BIT, new DbPlatformType("smallint", false)); - this.dbTypeMap.put(DbType.BLOB, new DbPlatformType("blob", false)); + this.dbTypeMap.put(DbType.CHAR, new DbPlatformType("nvarchar", 255)); - this.dbTypeMap.put(DbType.CLOB, new DbPlatformType("nclob", false)); + this.dbTypeMap.put(DbType.INTEGER, new DbPlatformType("integer", false)); this.dbTypeMap.put(DbType.JSONVARCHAR, new DbPlatformType("nvarchar", 255)); this.dbTypeMap.put(DbType.LINESTRING, new DbPlatformType("st_geometry")); @@ -50,8 +50,14 @@ public HanaPlatform() { this.dbTypeMap.put(DbType.SMALLINT, new DbPlatformType("smallint", false)); this.dbTypeMap.put(DbType.TINYINT, new DbPlatformType("smallint", false)); this.dbTypeMap.put(DbType.UUID, new DbPlatformType("varchar", 40)); - this.dbTypeMap.put(DbType.VARBINARY, new DbPlatformType("varbinary", 255)); - this.dbTypeMap.put(DbType.VARCHAR, new DbPlatformType("nvarchar", 255)); + + DbPlatformType nclob = new DbPlatformType("nclob", false); + dbTypeMap.put(DbType.VARCHAR, new DbPlatformType("nvarchar", 255, 5000, nclob)); + this.dbTypeMap.put(DbType.CLOB, nclob); + + DbPlatformType blob = new DbPlatformType("blob", false); + this.dbTypeMap.put(DbType.VARBINARY, new DbPlatformType("varbinary", 255, 5000, blob)); + this.dbTypeMap.put(DbType.BLOB, blob); } @Override diff --git a/platforms/mysql/src/main/java/io/ebean/platform/mysql/BaseMySqlPlatform.java b/platforms/mysql/src/main/java/io/ebean/platform/mysql/BaseMySqlPlatform.java index 6578901c8d..18f3794bc9 100644 --- a/platforms/mysql/src/main/java/io/ebean/platform/mysql/BaseMySqlPlatform.java +++ b/platforms/mysql/src/main/java/io/ebean/platform/mysql/BaseMySqlPlatform.java @@ -1,11 +1,7 @@ package io.ebean.platform.mysql; import io.ebean.Query; -import io.ebean.config.dbplatform.DatabasePlatform; -import io.ebean.config.dbplatform.DbPlatformType; -import io.ebean.config.dbplatform.DbType; -import io.ebean.config.dbplatform.IdType; -import io.ebean.config.dbplatform.SqlErrorCodes; +import io.ebean.config.dbplatform.*; import java.sql.Types; @@ -48,14 +44,29 @@ public BaseMySqlPlatform() { this.forwardOnlyHintOnFindIterate = true; this.booleanDbType = Types.BIT; + DbPlatformType clob = new DbPlatformType("longtext", 0, // use longtext, if length = 0 + new DbPlatformType("text", 0xFFFF, // use text up to 2^16-1 + new DbPlatformType("mediumtext", 0xFFFFFF, // use mediumtext up to 2^24-1 + new DbPlatformType("longtext", false)))); + + DbPlatformType blob = new DbPlatformType("longblob", 0, // use longtext, if length = 0 + new DbPlatformType("blob", 0xFFFF, // use text up to 2^16-1 + new DbPlatformType("mediumblob", 0xFFFFFF, // use mediumtext up to 2^24-1 + new DbPlatformType("longblob", false)))); + + + // CHECME: What would be a good max varchar size? + // we use 4000 here, so we do not hit the row limit + dbTypeMap.put(DbType.VARCHAR, new DbPlatformType("varchar", 255, 4000, clob)); + dbTypeMap.put(DbType.BIT, new DbPlatformType("tinyint(1)")); dbTypeMap.put(DbType.BOOLEAN, new DbPlatformType("tinyint(1)")); dbTypeMap.put(DbType.TIMESTAMP, new DbPlatformType("datetime(6)")); dbTypeMap.put(DbType.LOCALDATETIME, new DbPlatformType("datetime(6)")); - dbTypeMap.put(DbType.CLOB, new MySqlClob()); - dbTypeMap.put(DbType.BLOB, new MySqlBlob()); - dbTypeMap.put(DbType.BINARY, new DbPlatformType("binary", 255)); - dbTypeMap.put(DbType.VARBINARY, new DbPlatformType("varbinary", 255)); + dbTypeMap.put(DbType.CLOB, clob); + dbTypeMap.put(DbType.BLOB, blob); + dbTypeMap.put(DbType.BINARY, new DbPlatformType("binary", 255, 8000, blob)); + dbTypeMap.put(DbType.VARBINARY, new DbPlatformType("varbinary", 255, 8000, blob)); dbTypeMap.put(DbType.JSON, new DbPlatformType("json", false)); dbTypeMap.put(DbType.JSONB, new DbPlatformType("json", false)); } diff --git a/platforms/mysql/src/main/java/io/ebean/platform/mysql/MySqlBlob.java b/platforms/mysql/src/main/java/io/ebean/platform/mysql/MySqlBlob.java deleted file mode 100644 index ac4c66976c..0000000000 --- a/platforms/mysql/src/main/java/io/ebean/platform/mysql/MySqlBlob.java +++ /dev/null @@ -1,36 +0,0 @@ -package io.ebean.platform.mysql; - -import io.ebean.config.dbplatform.DbPlatformType; - -/** - * Support for blob, mediumblob or longblob selection based on the deployment - * length. - *

- * If no deployment length is defined longblob is used. - *

- */ -final class MySqlBlob extends DbPlatformType { - - private static final int POWER_2_16 = 65536; - private static final int POWER_2_24 = 16777216; - - MySqlBlob() { - super("blob"); - } - - @Override - public String renderType(int deployLength, int deployScale) { - if (deployLength >= POWER_2_24) { - return "longblob"; - } - if (deployLength >= POWER_2_16) { - return "mediumblob"; - } - if (deployLength < 1) { - // length not explicitly defined - return "longblob"; - } - return "blob"; - } - -} diff --git a/platforms/mysql/src/main/java/io/ebean/platform/mysql/MySqlClob.java b/platforms/mysql/src/main/java/io/ebean/platform/mysql/MySqlClob.java deleted file mode 100644 index 53cbadfec3..0000000000 --- a/platforms/mysql/src/main/java/io/ebean/platform/mysql/MySqlClob.java +++ /dev/null @@ -1,36 +0,0 @@ -package io.ebean.platform.mysql; - -import io.ebean.config.dbplatform.DbPlatformType; - -/** - * Support for text, mediumtext or longtext selection based on the deployment - * length. - *

- * If no deployment length is defined longtext is used. - *

- */ -final class MySqlClob extends DbPlatformType { - - private static final int POWER_2_16 = 65536; - private static final int POWER_2_24 = 16777216; - - MySqlClob() { - super("text"); - } - - @Override - public String renderType(int deployLength, int deployScale) { - if (deployLength >= POWER_2_24) { - return "longtext"; - } - if (deployLength >= POWER_2_16) { - return "mediumtext"; - } - if (deployLength < 1) { - // length not explicitly defined - return "longtext"; - } - return "text"; - } - -} diff --git a/platforms/nuodb/src/main/java/io/ebean/platform/nuodb/NuoDbPlatform.java b/platforms/nuodb/src/main/java/io/ebean/platform/nuodb/NuoDbPlatform.java index d08fa08260..a8fa428f95 100644 --- a/platforms/nuodb/src/main/java/io/ebean/platform/nuodb/NuoDbPlatform.java +++ b/platforms/nuodb/src/main/java/io/ebean/platform/nuodb/NuoDbPlatform.java @@ -4,12 +4,7 @@ import io.ebean.Query; import io.ebean.Query.LockWait; import io.ebean.annotation.Platform; -import io.ebean.config.dbplatform.DatabasePlatform; -import io.ebean.config.dbplatform.DbPlatformType; -import io.ebean.config.dbplatform.DbType; -import io.ebean.config.dbplatform.IdType; -import io.ebean.config.dbplatform.PlatformIdGenerator; -import io.ebean.config.dbplatform.SqlErrorCodes; +import io.ebean.config.dbplatform.*; import javax.sql.DataSource; @@ -41,6 +36,9 @@ public NuoDbPlatform() { .build(); dbTypeMap.put(DbType.INTEGER, new DbPlatformType("integer", false)); + // no max length found in documentation. Assuming 4000 + dbTypeMap.put(DbType.VARCHAR, new DbPlatformType("varchar", 255, 4000, new DbPlatformType("clob", false))); + dbTypeMap.put(DbType.VARBINARY, new DbPlatformType("varbinary", 255, 4000, new DbPlatformType("blob", false))); } @Override diff --git a/platforms/oracle/src/main/java/io/ebean/platform/oracle/OraclePlatform.java b/platforms/oracle/src/main/java/io/ebean/platform/oracle/OraclePlatform.java index b067907f7b..57096f0c0b 100644 --- a/platforms/oracle/src/main/java/io/ebean/platform/oracle/OraclePlatform.java +++ b/platforms/oracle/src/main/java/io/ebean/platform/oracle/OraclePlatform.java @@ -3,13 +3,7 @@ import io.ebean.BackgroundExecutor; import io.ebean.Query; import io.ebean.annotation.Platform; -import io.ebean.config.dbplatform.BasicSqlAnsiLimiter; -import io.ebean.config.dbplatform.DatabasePlatform; -import io.ebean.config.dbplatform.DbPlatformType; -import io.ebean.config.dbplatform.DbType; -import io.ebean.config.dbplatform.IdType; -import io.ebean.config.dbplatform.PlatformIdGenerator; -import io.ebean.config.dbplatform.SqlErrorCodes; +import io.ebean.config.dbplatform.*; import javax.sql.DataSource; import java.sql.Types; @@ -60,12 +54,17 @@ public OraclePlatform() { dbTypeMap.put(DbType.SMALLINT, new DbPlatformType("number", 5)); dbTypeMap.put(DbType.TINYINT, new DbPlatformType("number", 3)); dbTypeMap.put(DbType.DECIMAL, new DbPlatformType("number", 16, 3)); - dbTypeMap.put(DbType.VARCHAR, new DbPlatformType("varchar2", 255)); - dbTypeMap.put(DbType.LONGVARBINARY, new DbPlatformType("blob")); - dbTypeMap.put(DbType.LONGVARCHAR, new DbPlatformType("clob")); - dbTypeMap.put(DbType.VARBINARY, new DbPlatformType("raw", 255)); - dbTypeMap.put(DbType.BINARY, new DbPlatformType("raw", 255)); dbTypeMap.put(DbType.TIME, new DbPlatformType("timestamp")); + + DbPlatformType blob = new DbPlatformType("blob", false); + dbTypeMap.put(DbType.BLOB, blob); + dbTypeMap.put(DbType.LONGVARBINARY, blob); + dbTypeMap.put(DbType.VARBINARY, new DbPlatformType("raw", 255, 2000, blob)); + dbTypeMap.put(DbType.BINARY, new DbPlatformType("raw", 255, 2000, blob)); + + DbPlatformType clob = new DbPlatformType("clob", false); + dbTypeMap.put(DbType.LONGVARCHAR, clob); + dbTypeMap.put(DbType.VARCHAR, new DbPlatformType("varchar2", 255, 4000, clob)); } @Override diff --git a/platforms/postgres/src/main/java/io/ebean/platform/postgres/PostgresPlatform.java b/platforms/postgres/src/main/java/io/ebean/platform/postgres/PostgresPlatform.java index f59840998d..fbad23e3b6 100644 --- a/platforms/postgres/src/main/java/io/ebean/platform/postgres/PostgresPlatform.java +++ b/platforms/postgres/src/main/java/io/ebean/platform/postgres/PostgresPlatform.java @@ -2,22 +2,11 @@ import io.ebean.BackgroundExecutor; import io.ebean.Query; -import io.ebean.annotation.PartitionMode; import io.ebean.annotation.Platform; import io.ebean.config.PlatformConfig; -import io.ebean.config.dbplatform.DatabasePlatform; -import io.ebean.config.dbplatform.DbPlatformType; -import io.ebean.config.dbplatform.DbType; -import io.ebean.config.dbplatform.IdType; -import io.ebean.config.dbplatform.PlatformIdGenerator; -import io.ebean.config.dbplatform.SqlErrorCodes; -import io.ebean.util.SplitName; +import io.ebean.config.dbplatform.*; import javax.sql.DataSource; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; import java.sql.Types; /** @@ -70,6 +59,7 @@ public PostgresPlatform() { DbPlatformType dbTypeText = new DbPlatformType("text", false); DbPlatformType dbBytea = new DbPlatformType("bytea", false); + dbTypeMap.put(DbType.VARCHAR, new DbPlatformType("varchar", 255, 10_485_760, dbTypeText)); dbTypeMap.put(DbType.UUID, new DbPlatformType("uuid", false)); dbTypeMap.put(DbType.INET, new DbPlatformType("inet", false)); dbTypeMap.put(DbType.CIDR, new DbPlatformType("cidr", false)); @@ -139,11 +129,16 @@ protected String withForUpdate(String sql, Query.LockWait lockWait, Query.LockTy private String lock(Query.LockType lockType) { switch (lockType) { - case UPDATE: return FOR_UPDATE; - case NO_KEY_UPDATE: return FOR_NO_KEY_UPDATE; - case SHARE: return FOR_SHARE; - case KEY_SHARE: return FOR_KEY_SHARE; - case DEFAULT: return forUpdateNoKey ? FOR_NO_KEY_UPDATE : FOR_UPDATE; + case UPDATE: + return FOR_UPDATE; + case NO_KEY_UPDATE: + return FOR_NO_KEY_UPDATE; + case SHARE: + return FOR_SHARE; + case KEY_SHARE: + return FOR_KEY_SHARE; + case DEFAULT: + return forUpdateNoKey ? FOR_NO_KEY_UPDATE : FOR_UPDATE; } return FOR_UPDATE; } diff --git a/platforms/sqlanywhere/src/main/java/io/ebean/platform/sqlanywhere/SqlAnywherePlatform.java b/platforms/sqlanywhere/src/main/java/io/ebean/platform/sqlanywhere/SqlAnywherePlatform.java index a9aa3f41d8..2942fafb02 100644 --- a/platforms/sqlanywhere/src/main/java/io/ebean/platform/sqlanywhere/SqlAnywherePlatform.java +++ b/platforms/sqlanywhere/src/main/java/io/ebean/platform/sqlanywhere/SqlAnywherePlatform.java @@ -33,10 +33,17 @@ public SqlAnywherePlatform() { dbTypeMap.put(DbType.DOUBLE, new DbPlatformType("float(32)")); dbTypeMap.put(DbType.TINYINT, new DbPlatformType("smallint")); dbTypeMap.put(DbType.DECIMAL, new DbPlatformType("numeric", 16, 3)); - dbTypeMap.put(DbType.BLOB, new DbPlatformType("binary(4500)")); - dbTypeMap.put(DbType.CLOB, new DbPlatformType("long varchar")); - dbTypeMap.put(DbType.LONGVARBINARY, new DbPlatformType("long binary")); - dbTypeMap.put(DbType.LONGVARCHAR, new DbPlatformType("long varchar")); + + DbPlatformType clob = new DbPlatformType("long varchar", false); + dbTypeMap.put(DbType.CLOB, clob); + dbTypeMap.put(DbType.LONGVARCHAR,clob); + dbTypeMap.put(DbType.VARCHAR, new DbPlatformType("varchar", 255, 32767, clob)); + + DbPlatformType blob = new DbPlatformType("long binary", false); + dbTypeMap.put(DbType.VARBINARY, new DbPlatformType("varbinary", 255, 32767, blob)); + dbTypeMap.put(DbType.LONGVARBINARY, blob); + dbTypeMap.put(DbType.BLOB, blob); + } diff --git a/platforms/sqlserver/src/main/java/io/ebean/platform/sqlserver/SqlServer16Platform.java b/platforms/sqlserver/src/main/java/io/ebean/platform/sqlserver/SqlServer16Platform.java index 0e09dc8614..31cfab09b2 100644 --- a/platforms/sqlserver/src/main/java/io/ebean/platform/sqlserver/SqlServer16Platform.java +++ b/platforms/sqlserver/src/main/java/io/ebean/platform/sqlserver/SqlServer16Platform.java @@ -17,12 +17,19 @@ public SqlServer16Platform() { this.dbIdentity.setIdType(IdType.IDENTITY); // non-utf8 column types + DbPlatformType text = new DbPlatformType("text", false); + DbPlatformType varchar = new DbPlatformType("varchar", 255, 8000, text); dbTypeMap.put(DbType.CHAR, new DbPlatformType("char", 1)); - dbTypeMap.put(DbType.VARCHAR, new DbPlatformType("varchar", 255)); - dbTypeMap.put(DbType.LONGVARCHAR, new DbPlatformType("text")); - dbTypeMap.put(DbType.CLOB, new DbPlatformType("text")); - dbTypeMap.put(DbType.JSON, new DbPlatformType("text")); - dbTypeMap.put(DbType.JSONB, new DbPlatformType("text")); + dbTypeMap.put(DbType.VARCHAR, varchar); + dbTypeMap.put(DbType.LONGVARCHAR, text); + dbTypeMap.put(DbType.CLOB, text); + dbTypeMap.put(DbType.JSON, text); + dbTypeMap.put(DbType.JSONB, text); + + // old binary type + dbTypeMap.put(DbType.BLOB, new DbPlatformType("image", false)); + dbTypeMap.put(DbType.VARBINARY, new DbPlatformType("image", false)); + dbTypeMap.put(DbType.LONGVARBINARY, new DbPlatformType("image", false)); } } diff --git a/platforms/sqlserver/src/main/java/io/ebean/platform/sqlserver/SqlServerBasePlatform.java b/platforms/sqlserver/src/main/java/io/ebean/platform/sqlserver/SqlServerBasePlatform.java index 9d4bb37eeb..8aeb9130e0 100644 --- a/platforms/sqlserver/src/main/java/io/ebean/platform/sqlserver/SqlServerBasePlatform.java +++ b/platforms/sqlserver/src/main/java/io/ebean/platform/sqlserver/SqlServerBasePlatform.java @@ -65,13 +65,21 @@ abstract class SqlServerBasePlatform extends DatabasePlatform { dbTypeMap.put(DbType.LOCALDATETIME, new DbPlatformType("datetime2")); // UTF8 aware types - overwritten in SqlServer16 platform dbTypeMap.put(DbType.CHAR, new DbPlatformType("nchar", 1)); - dbTypeMap.put(DbType.VARCHAR, new DbPlatformType("nvarchar", 255)); - dbTypeMap.put(DbType.LONGVARCHAR, new DbPlatformType("nvarchar", Integer.MAX_VALUE)); - dbTypeMap.put(DbType.CLOB, new DbPlatformType("nvarchar", Integer.MAX_VALUE)); - dbTypeMap.put(DbType.JSON, new DbPlatformType("nvarchar", Integer.MAX_VALUE)); - dbTypeMap.put(DbType.JSONB, new DbPlatformType("nvarchar", Integer.MAX_VALUE)); - dbTypeMap.put(DbType.BLOB, new DbPlatformType("image")); - dbTypeMap.put(DbType.LONGVARBINARY, new DbPlatformType("image")); + + DbPlatformType longVarchar = new DbPlatformType("nvarchar(max)", false); + DbPlatformType varchar = new DbPlatformType("nvarchar", 255, 4000, longVarchar); + DbPlatformType json = new DbPlatformType("nvarchar(max)", 0, varchar); + dbTypeMap.put(DbType.VARCHAR, varchar); + dbTypeMap.put(DbType.LONGVARCHAR, longVarchar); + dbTypeMap.put(DbType.CLOB, longVarchar); + dbTypeMap.put(DbType.JSON, json); + dbTypeMap.put(DbType.JSONB, json); + + DbPlatformType blob = new DbPlatformType("varbinary(max)", false); + dbTypeMap.put(DbType.VARBINARY, new DbPlatformType("varbinary", 255, 8000, blob)); + + dbTypeMap.put(DbType.BLOB, blob); + dbTypeMap.put(DbType.LONGVARBINARY, blob); } @Override