From 2867c50090ccb66160ab45d6a28809dcf1091ed5 Mon Sep 17 00:00:00 2001 From: Roland Praml Date: Wed, 14 Jun 2023 17:10:14 +0200 Subject: [PATCH 01/14] Do not convert explicit defined column definitions --- .../ddlgeneration/platform/PlatformDdl.java | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) 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 } /** From 81443b77bc6093f3c6f9f6fa61e4608ee362d0bb Mon Sep 17 00:00:00 2001 From: Roland Praml Date: Wed, 14 Jun 2023 17:11:36 +0200 Subject: [PATCH 02/14] Fixes for Clickhouse platform --- .../dbmigration/ddlgeneration/platform/ClickHouseDbArray.java | 1 + .../java/io/ebean/test/config/platform/ClickHouseSetup.java | 2 +- .../java/io/ebean/platform/clickhouse/ClickHousePlatform.java | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) 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-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/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 From f5d0777b86d9b7e014256a4528166cc10c53e2fa Mon Sep 17 00:00:00 2001 From: Roland Praml Date: Wed, 14 Jun 2023 17:17:31 +0200 Subject: [PATCH 03/14] Added new test models with lengths --- .../xtest/dbmigration/DbMigrationTest.java | 4 + .../java/misc/migration/v1_1/ETestBinary.java | 72 +++++++++++++++ .../java/misc/migration/v1_1/ETestJson.java | 74 +++++++++++++++ .../java/misc/migration/v1_1/ETestLob.java | 92 +++++++++++++++++++ .../misc/migration/v1_1/ETestVarchar.java | 75 +++++++++++++++ 5 files changed, 317 insertions(+) create mode 100644 ebean-test/src/test/java/misc/migration/v1_1/ETestBinary.java create mode 100644 ebean-test/src/test/java/misc/migration/v1_1/ETestJson.java create mode 100644 ebean-test/src/test/java/misc/migration/v1_1/ETestLob.java create mode 100644 ebean-test/src/test/java/misc/migration/v1_1/ETestVarchar.java 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; + +} From 0dc4c6b11b97ed4db735e14c5ced2e032e65d6ce Mon Sep 17 00:00:00 2001 From: Roland Praml Date: Wed, 14 Jun 2023 17:18:06 +0200 Subject: [PATCH 04/14] NEW: DbPlatformType supports fallback, when length exceeded (removed SqlServer workaround) --- .../config/dbplatform/DbPlatformType.java | 87 +++++++++++++++---- 1 file changed, 68 insertions(+), 19 deletions(-) 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

    + *
  • "longtext" for unspecified length
  • + *
  • "text" for length up to 2^16-1
  • + *
  • "mediumtext" for length up to 2^24-1
  • + *
  • "longtext" else
  • + *
+ */ + 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
    + *
  • "varchar(255)" for unspecified length
  • + *
  • "varchar(N)" for N <= maxLength
  • + *
  • "varchar(max)" else
  • + *
+ */ + 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(')'); } /** From f499cc8c2c5bec03337b3538e5f35cbea9855bbf Mon Sep 17 00:00:00 2001 From: Roland Praml Date: Wed, 14 Jun 2023 17:19:48 +0200 Subject: [PATCH 05/14] SQLSERVER: max nvarchar length = 4000, varbinary = 8000 (no longer using deprecated image type by default) --- .../sqlserver/SqlServer16Platform.java | 17 +++++++++----- .../sqlserver/SqlServerBasePlatform.java | 22 +++++++++++++------ 2 files changed, 27 insertions(+), 12 deletions(-) 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 From 2a7a2d4dd45862d6e8f585cf922c09902297a4b1 Mon Sep 17 00:00:00 2001 From: Roland Praml Date: Wed, 14 Jun 2023 17:24:11 +0200 Subject: [PATCH 06/14] DB2: max varchar length = 4000, varbinary = 8000 --- .../src/main/java/io/ebean/platform/db2/BaseDB2Platform.java | 2 ++ 1 file changed, 2 insertions(+) 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)); From e89891038b0d094e8f69d508810144c7e40722f3 Mon Sep 17 00:00:00 2001 From: Roland Praml Date: Wed, 14 Jun 2023 17:30:28 +0200 Subject: [PATCH 07/14] Mysql: max varchar length = 4000, varbinary = 8000. Also refactored MySql(C|B)lob --- .../platform/mysql/BaseMySqlPlatform.java | 29 ++++++++++----- .../io/ebean/platform/mysql/MySqlBlob.java | 36 ------------------- .../io/ebean/platform/mysql/MySqlClob.java | 36 ------------------- 3 files changed, 20 insertions(+), 81 deletions(-) delete mode 100644 platforms/mysql/src/main/java/io/ebean/platform/mysql/MySqlBlob.java delete mode 100644 platforms/mysql/src/main/java/io/ebean/platform/mysql/MySqlClob.java 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"; - } - -} From 0f9462b7b5083c8de027bc90ac658a58c2b0cdab Mon Sep 17 00:00:00 2001 From: Roland Praml Date: Wed, 14 Jun 2023 17:32:00 +0200 Subject: [PATCH 08/14] Postgres: max varchar limit = 10MB --- .../platform/postgres/PostgresPlatform.java | 29 ++++++++----------- 1 file changed, 12 insertions(+), 17 deletions(-) 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; } From 578560c2e21a37e7a24808197095e3536fdae90c Mon Sep 17 00:00:00 2001 From: Roland Praml Date: Wed, 14 Jun 2023 17:42:17 +0200 Subject: [PATCH 09/14] Oracle: max varchar length = 4000, raw = 2000 --- .../ebean/platform/oracle/OraclePlatform.java | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) 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 From d1c21bf50adabde3e69fe9a842e7c59398ad57f8 Mon Sep 17 00:00:00 2001 From: Roland Praml Date: Wed, 14 Jun 2023 17:50:08 +0200 Subject: [PATCH 10/14] Hana, NuoDb, SqlAnywhere: add limits (untested!) --- .../java/io/ebean/platform/hana/HanaPlatform.java | 14 ++++++++++---- .../io/ebean/platform/nuodb/NuoDbPlatform.java | 10 ++++------ .../platform/sqlanywhere/SqlAnywherePlatform.java | 15 +++++++++++---- 3 files changed, 25 insertions(+), 14 deletions(-) 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/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/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); + } From 6fe3ec9355973a0942326e77eaaa45795da4a52a Mon Sep 17 00:00:00 2001 From: Roland Praml Date: Wed, 14 Jun 2023 17:50:26 +0200 Subject: [PATCH 11/14] Migration scripts --- .../dbmigration/clickhouse/1.1.sql | 92 ++++++++++++++++ .../clickhouse/1.4__dropsFor_1.3.sql | 4 + .../clickhouse/idx_clickhouse.migrations | 4 +- .../dbmigration/cockroach/1.1.sql | 96 +++++++++++++++++ .../cockroach/1.4__dropsFor_1.3.sql | 8 ++ .../cockroach/idx_cockroach.migrations | 4 +- .../migrationtest/dbmigration/db2fori/1.1.sql | 96 +++++++++++++++++ .../dbmigration/db2fori/1.4__dropsFor_1.3.sql | 32 ++++++ .../dbmigration/db2fori/idx_db2.migrations | 4 +- .../dbmigration/db2legacy/1.1.sql | 96 +++++++++++++++++ .../db2legacy/1.4__dropsFor_1.3.sql | 4 + .../db2legacy/idx_generic.migrations | 4 +- .../migrationtest/dbmigration/db2luw/1.1.sql | 96 +++++++++++++++++ .../dbmigration/db2luw/1.4__dropsFor_1.3.sql | 32 ++++++ .../dbmigration/db2luw/idx_db2.migrations | 4 +- .../migrationtest/dbmigration/db2zos/1.1.sql | 96 +++++++++++++++++ .../dbmigration/db2zos/1.4__dropsFor_1.3.sql | 32 ++++++ .../dbmigration/db2zos/idx_db2.migrations | 4 +- .../migrationtest/dbmigration/generic/1.1.sql | 96 +++++++++++++++++ .../dbmigration/generic/1.4__dropsFor_1.3.sql | 4 + .../generic/idx_generic.migrations | 4 +- .../migrationtest/dbmigration/h2/1.1.sql | 96 +++++++++++++++++ .../dbmigration/h2/1.4__dropsFor_1.3.sql | 8 ++ .../dbmigration/h2/idx_h2.migrations | 4 +- .../migrationtest/dbmigration/hana/1.1.sql | 96 +++++++++++++++++ .../dbmigration/hana/1.4__dropsFor_1.3.sql | 4 + .../dbmigration/hana/idx_hana.migrations | 4 +- .../migrationtest/dbmigration/hsqldb/1.1.sql | 96 +++++++++++++++++ .../dbmigration/hsqldb/1.4__dropsFor_1.3.sql | 8 ++ .../dbmigration/hsqldb/idx_hsqldb.migrations | 4 +- .../dbmigration/mariadb-noprocs/1.1.sql | 96 +++++++++++++++++ .../mariadb-noprocs/1.4__dropsFor_1.3.sql | 8 ++ .../mariadb-noprocs/idx_mariadb.migrations | 4 +- .../migrationtest/dbmigration/mariadb/1.1.sql | 96 +++++++++++++++++ .../dbmigration/mariadb/1.4__dropsFor_1.3.sql | 8 ++ .../mariadb/idx_mariadb.migrations | 4 +- .../dbmigration/model/1.1.model.xml | 88 +++++++++++++++ .../dbmigration/model/1.3.model.xml | 4 + .../model/1.4__dropsFor_1.3.model.xml | 4 + .../migrationtest/dbmigration/mysql/1.1.sql | 96 +++++++++++++++++ .../dbmigration/mysql/1.4__dropsFor_1.3.sql | 4 + .../dbmigration/mysql/idx_mysql.migrations | 4 +- .../migrationtest/dbmigration/mysql55/1.1.sql | 96 +++++++++++++++++ .../dbmigration/mysql55/1.4__dropsFor_1.3.sql | 4 + .../dbmigration/mysql55/idx_mysql.migrations | 4 +- .../migrationtest/dbmigration/nuodb/1.1.sql | 96 +++++++++++++++++ .../dbmigration/nuodb/1.4__dropsFor_1.3.sql | 8 ++ .../dbmigration/nuodb/idx_nuodb.migrations | 4 +- .../migrationtest/dbmigration/oracle/1.1.sql | 96 +++++++++++++++++ .../dbmigration/oracle/1.4__dropsFor_1.3.sql | 44 ++++++++ .../dbmigration/oracle/idx_oracle.migrations | 4 +- .../dbmigration/oracle11/1.1.sql | 100 ++++++++++++++++++ .../oracle11/1.4__dropsFor_1.3.sql | 44 ++++++++ .../oracle11/idx_oracle.migrations | 4 +- .../dbmigration/postgres/1.1.sql | 96 +++++++++++++++++ .../postgres/1.4__dropsFor_1.3.sql | 8 ++ .../postgres/idx_postgres.migrations | 4 +- .../dbmigration/postgres9/1.1.sql | 96 +++++++++++++++++ .../postgres9/1.4__dropsFor_1.3.sql | 8 ++ .../postgres9/idx_postgres.migrations | 4 +- .../dbmigration/sqlanywhere/1.0__initial.sql | 2 +- .../dbmigration/sqlanywhere/1.1.sql | 96 +++++++++++++++++ .../dbmigration/sqlanywhere/1.3.sql | 2 +- .../sqlanywhere/1.4__dropsFor_1.3.sql | 4 + .../sqlanywhere/idx_sqlanywhere.migrations | 8 +- .../migrationtest/dbmigration/sqlite/1.1.sql | 96 +++++++++++++++++ .../dbmigration/sqlite/1.4__dropsFor_1.3.sql | 4 + .../dbmigration/sqlite/idx_sqlite.migrations | 4 +- .../dbmigration/sqlserver16/1.1.sql | 96 +++++++++++++++++ .../sqlserver16/1.4__dropsFor_1.3.sql | 8 ++ .../sqlserver16/idx_sqlserver.migrations | 4 +- .../dbmigration/sqlserver17/1.0__initial.sql | 2 +- .../dbmigration/sqlserver17/1.1.sql | 100 ++++++++++++++++++ .../dbmigration/sqlserver17/1.3.sql | 2 +- .../sqlserver17/1.4__dropsFor_1.3.sql | 8 ++ .../sqlserver17/idx_sqlserver.migrations | 8 +- .../dbmigration/yugabyte/1.1.sql | 96 +++++++++++++++++ .../yugabyte/1.4__dropsFor_1.3.sql | 8 ++ .../yugabyte/idx_yugabyte.migrations | 4 +- 79 files changed, 2764 insertions(+), 56 deletions(-) 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 9849b051cf..9407dc6402 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 @@ -6,6 +6,98 @@ alter table migtest_e_basic drop constraint uq_migtest_e_basic_indextest2; alter table migtest_e_basic drop constraint uq_migtest_e_basic_indextest6; alter table migtest_e_enum drop constraint if exists ck_migtest_e_enum_test_status; -- apply changes +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 a38537136b..114a62efdf 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 @@ 1672735407, 1.0__initial.sql -540706946, 1.1.sql +-1952315279, 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 183dcdc714..77bda5e71c 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 @@ -11,6 +11,102 @@ drop index if exists ix_migtest_e_basic_indextest1; drop index if exists ix_migtest_e_basic_indextest5; drop index if exists ix_migtest_quoted_status1; -- apply changes +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 3a59a4520e..5b17c30060 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 @@ 1867456246, 1.0__initial.sql -1284257915, 1.1.sql +-187679618, 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 3032d43532..03a8a49b66 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 @@ -85,6 +85,102 @@ if exists (select indname from syscat.indexes where indschema = current_schema a end if; end$$; -- apply changes +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 d305cb8ef6..bf5b3f0547 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 @@ -283216660, 1.0__initial.sql --184000413, 1.1.sql +-353204789, 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 645d357f21..3dc7c46074 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 @@ -11,6 +11,102 @@ drop index if exists ix_migtest_e_basic_indextest1; drop index if exists ix_migtest_e_basic_indextest5; drop index if exists ix_migtest_quoted_status1; -- apply changes +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 7b2bfb7888..ca44cee99c 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 @@ -528359263, 1.0__initial.sql -253988246, 1.1.sql +308473502, 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 2f4beedaaf..f7d28b6066 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 @@ -85,6 +85,102 @@ if exists (select indname from syscat.indexes where indschema = current_schema a end if; end$$; -- apply changes +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 769c506f28..51f96139c8 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 1681764655, 1.0__initial.sql --1450326352, 1.1.sql +-678869146, 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 2f4beedaaf..f7d28b6066 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 @@ -85,6 +85,102 @@ if exists (select indname from syscat.indexes where indschema = current_schema a end if; end$$; -- apply changes +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 5a08e6b7c6..519d6f4b4f 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 @@ 1681764655, 1.0__initial.sql --1450326352, 1.1.sql +-678869146, 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 645d357f21..3dc7c46074 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 @@ -11,6 +11,102 @@ drop index if exists ix_migtest_e_basic_indextest1; drop index if exists ix_migtest_e_basic_indextest5; drop index if exists ix_migtest_quoted_status1; -- apply changes +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 7b2bfb7888..ca44cee99c 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 @@ -528359263, 1.0__initial.sql -253988246, 1.1.sql +308473502, 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 93ae665e68..a91bf0fe07 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 @@ -11,6 +11,102 @@ drop index if exists ix_migtest_e_basic_indextest1; drop index if exists ix_migtest_e_basic_indextest5; drop index if exists ix_migtest_quoted_status1; -- apply changes +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 6f155dc9a9..588dcf115c 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 @@ 400361768, 1.0__initial.sql -1979519453, 1.1.sql +58844973, 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 98d8266857..2a5175f4fe 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 @@ -59,6 +59,102 @@ exec 'drop index ix_migtest_quoted_status1'; end; $$; -- apply changes +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 fe3245fb3a..a859ad5d84 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 -1399184401, 1.0__initial.sql --1727762906, 1.1.sql +-871493688, 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 94010fa00b..462cb42e9d 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 @@ -11,6 +11,102 @@ drop index if exists ix_migtest_e_basic_indextest1; drop index if exists ix_migtest_e_basic_indextest5; drop index if exists ix_migtest_quoted_status1; -- apply changes +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 389d2fb131..0b9d8c1d1e 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 @@ 617421105, 1.0__initial.sql -84224587, 1.1.sql +-590637714, 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 4213de18ea..ac53c38f74 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 @@ -8,6 +8,102 @@ drop index ix_migtest_e_basic_indextest1 on migtest_e_basic; drop index ix_migtest_e_basic_indextest5 on migtest_e_basic; drop index ix_migtest_quoted_status1 on `migtest_QuOtEd`; -- apply changes +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 f64c4144b2..1ea9b536d8 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 @@ -1588268581, 1.0__initial.sql --1101751768, 1.1.sql +-1543277378, 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 4213de18ea..ac53c38f74 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 @@ -8,6 +8,102 @@ drop index ix_migtest_e_basic_indextest1 on migtest_e_basic; drop index ix_migtest_e_basic_indextest5 on migtest_e_basic; drop index ix_migtest_quoted_status1 on `migtest_QuOtEd`; -- apply changes +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 4bd9b11177..34f9b6b377 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 -1588268581, 1.0__initial.sql --1101751768, 1.1.sql +-1543277378, 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 1c704408ca..c59958a6cb 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 @@ -79,6 +79,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 2b8461633d..258f31c897 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 @@ -8,6 +8,102 @@ drop index ix_migtest_e_basic_indextest1 on migtest_e_basic; drop index ix_migtest_e_basic_indextest5 on migtest_e_basic; drop index ix_migtest_quoted_status1 on `migtest_QuOtEd`; -- apply changes +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 805eb44597..b2fc4d5496 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 -1156696445, 1.0__initial.sql --92753611, 1.1.sql +1625754872, 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 2b8461633d..258f31c897 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 @@ -8,6 +8,102 @@ drop index ix_migtest_e_basic_indextest1 on migtest_e_basic; drop index ix_migtest_e_basic_indextest5 on migtest_e_basic; drop index ix_migtest_quoted_status1 on `migtest_QuOtEd`; -- apply changes +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 503e38c465..35f9d5e0b9 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 -165038024, 1.0__initial.sql --92753611, 1.1.sql +1625754872, 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 31cdd37566..935d3d7d2a 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 @@ -11,6 +11,102 @@ drop index if exists ix_migtest_e_basic_indextest1; drop index if exists ix_migtest_e_basic_indextest5; drop index if exists ix_migtest_quoted_status1; -- apply changes +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 40897ee779..312205fd4d 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 @@ -588780599, 1.0__initial.sql --2079708895, 1.1.sql +-2132614794, 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 f78c04b789..5061df2386 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 @@ -56,6 +56,102 @@ drop index ix_migtest_e_basic_indextest1; drop index ix_migtest_e_basic_indextest5; drop index ix_migtest_quoted_status1; -- apply changes +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 9b6a8abe87..83f0e9e91d 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 @@ -126940583, 1.0__initial.sql -740264587, 1.1.sql +-1646771053, 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 7a24eef36c..bf0f4278ed 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 @@ -56,6 +56,106 @@ drop index ix_migtest_e_basic_indextest1; drop index ix_migtest_e_basic_indextest5; drop index ix_migtest_quoted_status1; -- apply changes +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 2fee87c5d3..d9f99e4a35 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 @@ 21261569, 1.0__initial.sql --123689547, 1.1.sql +-772002701, 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 3a0faaf28e..d2fa145da9 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 @@ -14,6 +14,102 @@ drop index if exists idxd_migtest_0; drop index concurrently if exists ix_migtest_oto_child_lowername_id; drop index if exists ix_migtest_oto_child_lowername; -- apply changes +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 0dab559008..42f2974d3b 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 @@ -22203872, 1.0__initial.sql --1432572923, 1.1.sql +-449527326, 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 f866990168..8f131d01ef 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 @@ -14,6 +14,102 @@ drop index if exists idxd_migtest_0; drop index concurrently if exists ix_migtest_oto_child_lowername_id; drop index if exists ix_migtest_oto_child_lowername; -- apply changes +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 a6ae1b7d87..f75bfffc3b 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 @@ 559327334, 1.0__initial.sql --690271384, 1.1.sql +-788518640, 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 3d95c05617..9def166785 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 @@ -82,7 +82,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 f6c2af545e..13cd0ce15a 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 @@ -11,6 +11,102 @@ drop index if exists ix_migtest_e_basic_indextest1; drop index if exists ix_migtest_e_basic_indextest5; drop index if exists ix_migtest_quoted_status1; -- apply changes +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 06bb6b597f..07b9f09320 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 @@ -1278110701, 1.0__initial.sql -128425002, 1.1.sql +1999303200, 1.0__initial.sql +-2053964976, 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 3c93d203cd..7d06abefa5 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 @@ -11,6 +11,102 @@ drop index if exists ix_migtest_e_basic_indextest1; drop index if exists ix_migtest_e_basic_indextest5; drop index if exists ix_migtest_quoted_status1; -- apply changes +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 ce94a01e19..9b70e29fd3 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 @@ 238997470, 1.0__initial.sql -1828386122, 1.1.sql +-456448682, 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 fd69bd2dd0..69366b52c5 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 @@ -13,6 +13,102 @@ IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('migtest_e_b IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('migtest_e_basic','U') AND name = 'ix_migtest_e_basic_indextest5') drop index ix_migtest_e_basic_indextest5 ON migtest_e_basic; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('"migtest_QuOtEd"','U') AND name = 'ix_migtest_quoted_status1') drop index ix_migtest_quoted_status1 ON "migtest_QuOtEd"; -- apply changes +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 dd52a9c473..7917299b42 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 254353963, 1.0__initial.sql -1327099983, 1.1.sql +262569028, 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 e79e2d7b55..a08c714056 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 @@ -93,7 +93,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 c6a7c1466c..dc3bb06afb 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 @@ -13,6 +13,106 @@ IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('migtest_e_b IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('migtest_e_basic','U') AND name = 'ix_migtest_e_basic_indextest5') drop index ix_migtest_e_basic_indextest5 ON migtest_e_basic; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('"migtest_QuOtEd"','U') AND name = 'ix_migtest_quoted_status1') drop index ix_migtest_quoted_status1 ON "migtest_QuOtEd"; -- apply changes +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 29d90f613e..73f6f67d43 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 --2080592180, 1.0__initial.sql --579377447, 1.1.sql +105089711, 1.0__initial.sql +307269467, 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 f6a1e56ff8..40fe12382f 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 @@ -11,6 +11,102 @@ drop index if exists ix_migtest_e_basic_indextest1; drop index if exists ix_migtest_e_basic_indextest5; drop index if exists ix_migtest_quoted_status1; -- apply changes +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 a3e8f8961b..fbf47fa64a 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 @@ 1799266243, 1.0__initial.sql --1967687506, 1.1.sql +1695259133, 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 From f63b013ef9ec7dc5e406bc17894039f634532e84 Mon Sep 17 00:00:00 2001 From: Roland Praml Date: Wed, 14 Jun 2023 18:14:12 +0200 Subject: [PATCH 12/14] Added and fixed tests --- .../io/ebeaninternal/dbmigration/MySqlPlatformTest.java | 8 +++++++- .../ebeaninternal/dbmigration/SqlserverPlatformTest.java | 6 +++++- 2 files changed, 12 insertions(+), 2 deletions(-) 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 From d8238735c12e63f02b9cdacfd892b232dccf8d46 Mon Sep 17 00:00:00 2001 From: Roland Praml Date: Wed, 14 Jun 2023 18:19:17 +0200 Subject: [PATCH 13/14] Fix also DbTypeMapTest, which uses the new varbinary type --- .../java/io/ebean/xtest/config/dbplatform/DbTypeMapTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)"); } From 77610672a90c3c863e08f542afc7b31dd6bf4000 Mon Sep 17 00:00:00 2001 From: Roland Praml Date: Wed, 14 Jun 2023 18:24:23 +0200 Subject: [PATCH 14/14] Regenerated migration scripts again --- .../dbmigration/clickhouse/1.0__initial.sql | 18 ---------- .../dbmigration/clickhouse/1.1.sql | 18 ++++++++++ .../clickhouse/idx_clickhouse.migrations | 4 +-- .../dbmigration/cockroach/1.0__initial.sql | 31 ----------------- .../dbmigration/cockroach/1.1.sql | 31 +++++++++++++++++ .../cockroach/idx_cockroach.migrations | 4 +-- .../dbmigration/db2fori/1.0__initial.sql | 31 ----------------- .../migrationtest/dbmigration/db2fori/1.1.sql | 31 +++++++++++++++++ .../dbmigration/db2fori/idx_db2.migrations | 4 +-- .../dbmigration/db2legacy/1.0__initial.sql | 31 ----------------- .../dbmigration/db2legacy/1.1.sql | 31 +++++++++++++++++ .../db2legacy/idx_generic.migrations | 4 +-- .../dbmigration/db2luw/1.0__initial.sql | 31 ----------------- .../migrationtest/dbmigration/db2luw/1.1.sql | 31 +++++++++++++++++ .../dbmigration/db2luw/idx_db2.migrations | 4 +-- .../dbmigration/db2zos/1.0__initial.sql | 31 ----------------- .../migrationtest/dbmigration/db2zos/1.1.sql | 31 +++++++++++++++++ .../dbmigration/db2zos/idx_db2.migrations | 4 +-- .../dbmigration/generic/1.0__initial.sql | 31 ----------------- .../migrationtest/dbmigration/generic/1.1.sql | 31 +++++++++++++++++ .../generic/idx_generic.migrations | 4 +-- .../dbmigration/h2/1.0__initial.sql | 31 ----------------- .../migrationtest/dbmigration/h2/1.1.sql | 31 +++++++++++++++++ .../dbmigration/h2/idx_h2.migrations | 4 +-- .../dbmigration/hana/1.0__initial.sql | 31 ----------------- .../migrationtest/dbmigration/hana/1.1.sql | 31 +++++++++++++++++ .../dbmigration/hana/idx_hana.migrations | 4 +-- .../dbmigration/hsqldb/1.0__initial.sql | 31 ----------------- .../migrationtest/dbmigration/hsqldb/1.1.sql | 31 +++++++++++++++++ .../dbmigration/hsqldb/idx_hsqldb.migrations | 4 +-- .../mariadb-noprocs/1.0__initial.sql | 31 ----------------- .../dbmigration/mariadb-noprocs/1.1.sql | 31 +++++++++++++++++ .../mariadb-noprocs/idx_mariadb.migrations | 4 +-- .../dbmigration/mariadb/1.0__initial.sql | 31 ----------------- .../migrationtest/dbmigration/mariadb/1.1.sql | 31 +++++++++++++++++ .../mariadb/idx_mariadb.migrations | 4 +-- .../dbmigration/model/1.0__initial.model.xml | 16 --------- .../dbmigration/model/1.1.model.xml | 16 +++++++++ .../dbmigration/mysql/1.0__initial.sql | 31 ----------------- .../migrationtest/dbmigration/mysql/1.1.sql | 31 +++++++++++++++++ .../dbmigration/mysql/idx_mysql.migrations | 4 +-- .../dbmigration/mysql55/1.0__initial.sql | 31 ----------------- .../migrationtest/dbmigration/mysql55/1.1.sql | 31 +++++++++++++++++ .../dbmigration/mysql55/idx_mysql.migrations | 4 +-- .../dbmigration/nuodb/1.0__initial.sql | 31 ----------------- .../migrationtest/dbmigration/nuodb/1.1.sql | 31 +++++++++++++++++ .../dbmigration/nuodb/idx_nuodb.migrations | 4 +-- .../dbmigration/oracle/1.0__initial.sql | 31 ----------------- .../migrationtest/dbmigration/oracle/1.1.sql | 31 +++++++++++++++++ .../dbmigration/oracle/idx_oracle.migrations | 4 +-- .../dbmigration/oracle11/1.0__initial.sql | 34 ------------------- .../dbmigration/oracle11/1.1.sql | 34 +++++++++++++++++++ .../oracle11/idx_oracle.migrations | 4 +-- .../dbmigration/postgres/1.0__initial.sql | 31 ----------------- .../dbmigration/postgres/1.1.sql | 31 +++++++++++++++++ .../postgres/idx_postgres.migrations | 4 +-- .../dbmigration/postgres9/1.0__initial.sql | 31 ----------------- .../dbmigration/postgres9/1.1.sql | 31 +++++++++++++++++ .../postgres9/idx_postgres.migrations | 4 +-- .../dbmigration/sqlanywhere/1.0__initial.sql | 31 ----------------- .../dbmigration/sqlanywhere/1.1.sql | 31 +++++++++++++++++ .../sqlanywhere/idx_sqlanywhere.migrations | 4 +-- .../dbmigration/sqlite/1.0__initial.sql | 25 -------------- .../migrationtest/dbmigration/sqlite/1.1.sql | 25 ++++++++++++++ .../dbmigration/sqlite/idx_sqlite.migrations | 4 +-- .../dbmigration/sqlserver16/1.0__initial.sql | 31 ----------------- .../dbmigration/sqlserver16/1.1.sql | 31 +++++++++++++++++ .../sqlserver16/idx_sqlserver.migrations | 4 +-- .../dbmigration/sqlserver17/1.0__initial.sql | 34 ------------------- .../dbmigration/sqlserver17/1.1.sql | 34 +++++++++++++++++++ .../sqlserver17/idx_sqlserver.migrations | 4 +-- .../dbmigration/yugabyte/1.0__initial.sql | 31 ----------------- .../dbmigration/yugabyte/1.1.sql | 31 +++++++++++++++++ .../yugabyte/idx_yugabyte.migrations | 4 +-- 74 files changed, 795 insertions(+), 795 deletions(-) diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/clickhouse/1.0__initial.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/clickhouse/1.0__initial.sql index 3c8ce6567e..228422449b 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/clickhouse/1.0__initial.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/clickhouse/1.0__initial.sql @@ -45,24 +45,6 @@ create table migtest_fk_set_null ( one_id UInt64 ) ENGINE = Log(); -create table drop_main ( - id UInt32 -) ENGINE = Log(); - -create table drop_main_drop_ref_many ( - drop_main_id UInt32, - drop_ref_many_id UInt32 -) ENGINE = Log(); - -create table drop_ref_many ( - id UInt32 -) ENGINE = Log(); - -create table drop_ref_one ( - id UInt32, - parent_id UInt32 -) ENGINE = Log(); - create table migtest_e_basic ( id UInt32, status String, 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 9407dc6402..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 @@ -6,6 +6,24 @@ alter table migtest_e_basic drop constraint uq_migtest_e_basic_indextest2; alter table migtest_e_basic drop constraint uq_migtest_e_basic_indextest6; alter table migtest_e_enum drop constraint if exists ck_migtest_e_enum_test_status; -- apply changes +create table drop_main ( + id UInt32 +) ENGINE = Log(); + +create table drop_main_drop_ref_many ( + drop_main_id UInt32, + drop_ref_many_id UInt32 +) ENGINE = Log(); + +create table drop_ref_many ( + id UInt32 +) ENGINE = Log(); + +create table drop_ref_one ( + id UInt32, + parent_id UInt32 +) ENGINE = Log(); + create table migtest_e_test_binary ( id UInt32, test_byte16 String, 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 114a62efdf..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,5 +1,5 @@ -1672735407, 1.0__initial.sql --1952315279, 1.1.sql +193400547, 1.0__initial.sql +1036221356, 1.1.sql 688811494, 1.2__dropsFor_1.1.sql 1015552567, 1.3.sql -252580551, 1.4__dropsFor_1.3.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/cockroach/1.0__initial.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/cockroach/1.0__initial.sql index 79a5c43290..4f47e07743 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/cockroach/1.0__initial.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/cockroach/1.0__initial.sql @@ -54,28 +54,6 @@ create table migtest_fk_set_null ( constraint pk_migtest_fk_set_null primary key (id) ); -create table drop_main ( - id integer generated by default as identity not null, - constraint pk_drop_main primary key (id) -); - -create table drop_main_drop_ref_many ( - drop_main_id integer not null, - drop_ref_many_id integer not null, - constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) -); - -create table drop_ref_many ( - id integer generated by default as identity not null, - constraint pk_drop_ref_many primary key (id) -); - -create table drop_ref_one ( - id integer generated by default as identity not null, - parent_id integer, - constraint pk_drop_ref_one primary key (id) -); - create table migtest_e_basic ( id integer generated by default as identity not null, status varchar(1), @@ -215,15 +193,6 @@ alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id forei create index ix_migtest_fk_set_null_one_id on migtest_fk_set_null (one_id); alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id) on delete set null on update restrict; -create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict; - -create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict; - -create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); -alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; - create index ix_migtest_e_basic_eref_id on migtest_e_basic (eref_id); alter table migtest_e_basic add constraint fk_migtest_e_basic_eref_id foreign key (eref_id) references migtest_e_ref (id) on delete restrict on update restrict; 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 77bda5e71c..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 @@ -11,6 +11,28 @@ drop index if exists ix_migtest_e_basic_indextest1; drop index if exists ix_migtest_e_basic_indextest5; drop index if exists ix_migtest_quoted_status1; -- apply changes +create table drop_main ( + id integer generated by default as identity not null, + constraint pk_drop_main primary key (id) +); + +create table drop_main_drop_ref_many ( + drop_main_id integer not null, + drop_ref_many_id integer not null, + constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) +); + +create table drop_ref_many ( + id integer generated by default as identity not null, + constraint pk_drop_ref_many primary key (id) +); + +create table drop_ref_one ( + id integer generated by default as identity not null, + parent_id integer, + 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, @@ -186,6 +208,15 @@ alter table migtest_e_basic add constraint uq_migtest_e_basic_indextest4 unique alter table migtest_e_basic add constraint uq_migtest_e_basic_indextest5 unique (indextest5); alter table "table" add constraint uq_table_select unique ("select"); -- foreign keys and indices +create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict; + +create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict; + +create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); +alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; 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 5b17c30060..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,5 +1,5 @@ -1867456246, 1.0__initial.sql --187679618, 1.1.sql +1434934404, 1.0__initial.sql +-1445091875, 1.1.sql 856096334, 1.2__dropsFor_1.1.sql -279468991, 1.3.sql -1398154763, 1.4__dropsFor_1.3.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/1.0__initial.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/1.0__initial.sql index b4660d18ff..9931da4b1d 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/1.0__initial.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/1.0__initial.sql @@ -54,28 +54,6 @@ create table migtest_fk_set_null ( constraint pk_migtest_fk_set_null primary key (id) ); -create table drop_main ( - id integer generated by default as identity not null, - constraint pk_drop_main primary key (id) -); - -create table drop_main_drop_ref_many ( - drop_main_id integer not null, - drop_ref_many_id integer not null, - constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) -); - -create table drop_ref_many ( - id integer generated by default as identity not null, - constraint pk_drop_ref_many primary key (id) -); - -create table drop_ref_one ( - id integer generated by default as identity not null, - parent_id integer, - constraint pk_drop_ref_one primary key (id) -); - create table migtest_e_basic ( id integer generated by default as identity not null, status varchar(1), @@ -254,15 +232,6 @@ alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id forei create index ix_migtest_fk_set_null_one_id on migtest_fk_set_null (one_id); alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id) on delete set null on update restrict; -create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict; - -create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict; - -create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); -alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; - create index ix_migtest_e_basic_eref_id on migtest_e_basic (eref_id); alter table migtest_e_basic add constraint fk_migtest_e_basic_eref_id foreign key (eref_id) references migtest_e_ref (id) on delete restrict on update restrict; 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 03a8a49b66..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 @@ -85,6 +85,28 @@ if exists (select indname from syscat.indexes where indschema = current_schema a end if; end$$; -- apply changes +create table drop_main ( + id integer generated by default as identity not null, + constraint pk_drop_main primary key (id) +); + +create table drop_main_drop_ref_many ( + drop_main_id integer not null, + drop_ref_many_id integer not null, + constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) +); + +create table drop_ref_many ( + id integer generated by default as identity not null, + constraint pk_drop_ref_many primary key (id) +); + +create table drop_ref_one ( + id integer generated by default as identity not null, + parent_id integer, + 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), @@ -306,6 +328,15 @@ comment on column "table"."index" is 'this is an other comment'; alter table "table" add versioning use history table table_history; create unique index uq_table_select on "table"("select") exclude null keys; -- foreign keys and indices +create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict; + +create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict; + +create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); +alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; 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 bf5b3f0547..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,5 +1,5 @@ --283216660, 1.0__initial.sql --353204789, 1.1.sql +-1467839063, 1.0__initial.sql +1392865974, 1.1.sql -1187336846, 1.2__dropsFor_1.1.sql -1811865535, 1.3.sql 1864105401, 1.4__dropsFor_1.3.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/1.0__initial.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/1.0__initial.sql index 1490ff0048..7b7bddd1db 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/1.0__initial.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/1.0__initial.sql @@ -54,28 +54,6 @@ create table migtest_fk_set_null ( constraint pk_migtest_fk_set_null primary key (id) ); -create table drop_main ( - id integer auto_increment not null, - constraint pk_drop_main primary key (id) -); - -create table drop_main_drop_ref_many ( - drop_main_id integer not null, - drop_ref_many_id integer not null, - constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) -); - -create table drop_ref_many ( - id integer auto_increment not null, - constraint pk_drop_ref_many primary key (id) -); - -create table drop_ref_one ( - id integer auto_increment not null, - parent_id integer, - constraint pk_drop_ref_one primary key (id) -); - create table migtest_e_basic ( id integer auto_increment not null, status varchar(1), @@ -216,15 +194,6 @@ alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id forei create index ix_migtest_fk_set_null_one_id on migtest_fk_set_null (one_id); alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id) on delete set null on update restrict; -create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict; - -create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict; - -create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); -alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; - create index ix_migtest_e_basic_eref_id on migtest_e_basic (eref_id); alter table migtest_e_basic add constraint fk_migtest_e_basic_eref_id foreign key (eref_id) references migtest_e_ref (id) on delete restrict on update restrict; 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 3dc7c46074..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 @@ -11,6 +11,28 @@ drop index if exists ix_migtest_e_basic_indextest1; drop index if exists ix_migtest_e_basic_indextest5; drop index if exists ix_migtest_quoted_status1; -- apply changes +create table drop_main ( + id integer auto_increment not null, + constraint pk_drop_main primary key (id) +); + +create table drop_main_drop_ref_many ( + drop_main_id integer not null, + drop_ref_many_id integer not null, + constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) +); + +create table drop_ref_many ( + id integer auto_increment not null, + constraint pk_drop_ref_many primary key (id) +); + +create table drop_ref_one ( + id integer auto_increment not null, + parent_id integer, + constraint pk_drop_ref_one primary key (id) +); + create table migtest_e_test_binary ( id integer auto_increment not null, test_byte16 varbinary(16), @@ -189,6 +211,15 @@ comment on table migtest_e_history is 'We have history now'; comment on column "table"."index" is 'this is an other comment'; alter table "table" add constraint uq_table_select unique ("select"); -- foreign keys and indices +create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict; + +create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict; + +create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); +alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; 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 ca44cee99c..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,5 +1,5 @@ --528359263, 1.0__initial.sql -308473502, 1.1.sql +-1547037623, 1.0__initial.sql +275373095, 1.1.sql 688811494, 1.2__dropsFor_1.1.sql 674925120, 1.3.sql -252580551, 1.4__dropsFor_1.3.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/1.0__initial.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/1.0__initial.sql index 132b608f75..8b9d60aad6 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/1.0__initial.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/1.0__initial.sql @@ -54,28 +54,6 @@ create table migtest_fk_set_null ( constraint pk_migtest_fk_set_null primary key (id) ); -create table drop_main ( - id integer generated by default as identity not null, - constraint pk_drop_main primary key (id) -); - -create table drop_main_drop_ref_many ( - drop_main_id integer not null, - drop_ref_many_id integer not null, - constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) -); - -create table drop_ref_many ( - id integer generated by default as identity not null, - constraint pk_drop_ref_many primary key (id) -); - -create table drop_ref_one ( - id integer generated by default as identity not null, - parent_id integer, - constraint pk_drop_ref_one primary key (id) -); - create table migtest_e_basic ( id integer generated by default as identity not null, status varchar(1), @@ -254,15 +232,6 @@ alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id forei create index ix_migtest_fk_set_null_one_id on migtest_fk_set_null (one_id); alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id) on delete set null on update restrict; -create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict; - -create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict; - -create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); -alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; - create index ix_migtest_e_basic_eref_id on migtest_e_basic (eref_id); alter table migtest_e_basic add constraint fk_migtest_e_basic_eref_id foreign key (eref_id) references migtest_e_ref (id) on delete restrict on update restrict; 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 f7d28b6066..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 @@ -85,6 +85,28 @@ if exists (select indname from syscat.indexes where indschema = current_schema a end if; end$$; -- apply changes +create table drop_main ( + id integer generated by default as identity not null, + constraint pk_drop_main primary key (id) +); + +create table drop_main_drop_ref_many ( + drop_main_id integer not null, + drop_ref_many_id integer not null, + constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) +); + +create table drop_ref_many ( + id integer generated by default as identity not null, + constraint pk_drop_ref_many primary key (id) +); + +create table drop_ref_one ( + id integer generated by default as identity not null, + parent_id integer, + 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), @@ -306,6 +328,15 @@ comment on column "table"."index" is 'this is an other comment'; alter table "table" add versioning use history table table_history; create unique index uq_table_select on "table"("select") exclude null keys; -- foreign keys and indices +create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict; + +create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict; + +create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); +alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; 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 51f96139c8..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,6 +1,6 @@ 1307787475, I__create_tablespaces.sql -1681764655, 1.0__initial.sql --678869146, 1.1.sql +2058232717, 1.0__initial.sql +372361421, 1.1.sql -1187336846, 1.2__dropsFor_1.1.sql 469192394, 1.3.sql 1864105401, 1.4__dropsFor_1.3.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/1.0__initial.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/1.0__initial.sql index 132b608f75..8b9d60aad6 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/1.0__initial.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/1.0__initial.sql @@ -54,28 +54,6 @@ create table migtest_fk_set_null ( constraint pk_migtest_fk_set_null primary key (id) ); -create table drop_main ( - id integer generated by default as identity not null, - constraint pk_drop_main primary key (id) -); - -create table drop_main_drop_ref_many ( - drop_main_id integer not null, - drop_ref_many_id integer not null, - constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) -); - -create table drop_ref_many ( - id integer generated by default as identity not null, - constraint pk_drop_ref_many primary key (id) -); - -create table drop_ref_one ( - id integer generated by default as identity not null, - parent_id integer, - constraint pk_drop_ref_one primary key (id) -); - create table migtest_e_basic ( id integer generated by default as identity not null, status varchar(1), @@ -254,15 +232,6 @@ alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id forei create index ix_migtest_fk_set_null_one_id on migtest_fk_set_null (one_id); alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id) on delete set null on update restrict; -create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict; - -create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict; - -create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); -alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; - create index ix_migtest_e_basic_eref_id on migtest_e_basic (eref_id); alter table migtest_e_basic add constraint fk_migtest_e_basic_eref_id foreign key (eref_id) references migtest_e_ref (id) on delete restrict on update restrict; 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 f7d28b6066..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 @@ -85,6 +85,28 @@ if exists (select indname from syscat.indexes where indschema = current_schema a end if; end$$; -- apply changes +create table drop_main ( + id integer generated by default as identity not null, + constraint pk_drop_main primary key (id) +); + +create table drop_main_drop_ref_many ( + drop_main_id integer not null, + drop_ref_many_id integer not null, + constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) +); + +create table drop_ref_many ( + id integer generated by default as identity not null, + constraint pk_drop_ref_many primary key (id) +); + +create table drop_ref_one ( + id integer generated by default as identity not null, + parent_id integer, + 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), @@ -306,6 +328,15 @@ comment on column "table"."index" is 'this is an other comment'; alter table "table" add versioning use history table table_history; create unique index uq_table_select on "table"("select") exclude null keys; -- foreign keys and indices +create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict; + +create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict; + +create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); +alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; 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 519d6f4b4f..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,5 +1,5 @@ -1681764655, 1.0__initial.sql --678869146, 1.1.sql +2058232717, 1.0__initial.sql +372361421, 1.1.sql -1187336846, 1.2__dropsFor_1.1.sql 469192394, 1.3.sql 1864105401, 1.4__dropsFor_1.3.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/generic/1.0__initial.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/generic/1.0__initial.sql index 1490ff0048..7b7bddd1db 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/generic/1.0__initial.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/generic/1.0__initial.sql @@ -54,28 +54,6 @@ create table migtest_fk_set_null ( constraint pk_migtest_fk_set_null primary key (id) ); -create table drop_main ( - id integer auto_increment not null, - constraint pk_drop_main primary key (id) -); - -create table drop_main_drop_ref_many ( - drop_main_id integer not null, - drop_ref_many_id integer not null, - constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) -); - -create table drop_ref_many ( - id integer auto_increment not null, - constraint pk_drop_ref_many primary key (id) -); - -create table drop_ref_one ( - id integer auto_increment not null, - parent_id integer, - constraint pk_drop_ref_one primary key (id) -); - create table migtest_e_basic ( id integer auto_increment not null, status varchar(1), @@ -216,15 +194,6 @@ alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id forei create index ix_migtest_fk_set_null_one_id on migtest_fk_set_null (one_id); alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id) on delete set null on update restrict; -create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict; - -create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict; - -create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); -alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; - create index ix_migtest_e_basic_eref_id on migtest_e_basic (eref_id); alter table migtest_e_basic add constraint fk_migtest_e_basic_eref_id foreign key (eref_id) references migtest_e_ref (id) on delete restrict on update restrict; 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 3dc7c46074..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 @@ -11,6 +11,28 @@ drop index if exists ix_migtest_e_basic_indextest1; drop index if exists ix_migtest_e_basic_indextest5; drop index if exists ix_migtest_quoted_status1; -- apply changes +create table drop_main ( + id integer auto_increment not null, + constraint pk_drop_main primary key (id) +); + +create table drop_main_drop_ref_many ( + drop_main_id integer not null, + drop_ref_many_id integer not null, + constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) +); + +create table drop_ref_many ( + id integer auto_increment not null, + constraint pk_drop_ref_many primary key (id) +); + +create table drop_ref_one ( + id integer auto_increment not null, + parent_id integer, + constraint pk_drop_ref_one primary key (id) +); + create table migtest_e_test_binary ( id integer auto_increment not null, test_byte16 varbinary(16), @@ -189,6 +211,15 @@ comment on table migtest_e_history is 'We have history now'; comment on column "table"."index" is 'this is an other comment'; alter table "table" add constraint uq_table_select unique ("select"); -- foreign keys and indices +create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict; + +create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict; + +create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); +alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; 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 ca44cee99c..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,5 +1,5 @@ --528359263, 1.0__initial.sql -308473502, 1.1.sql +-1547037623, 1.0__initial.sql +275373095, 1.1.sql 688811494, 1.2__dropsFor_1.1.sql 674925120, 1.3.sql -252580551, 1.4__dropsFor_1.3.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/h2/1.0__initial.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/h2/1.0__initial.sql index 93a101a08a..d405e6e70e 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/h2/1.0__initial.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/h2/1.0__initial.sql @@ -54,28 +54,6 @@ create table migtest_fk_set_null ( constraint pk_migtest_fk_set_null primary key (id) ); -create table drop_main ( - id integer generated by default as identity not null, - constraint pk_drop_main primary key (id) -); - -create table drop_main_drop_ref_many ( - drop_main_id integer not null, - drop_ref_many_id integer not null, - constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) -); - -create table drop_ref_many ( - id integer generated by default as identity not null, - constraint pk_drop_ref_many primary key (id) -); - -create table drop_ref_one ( - id integer generated by default as identity not null, - parent_id integer, - constraint pk_drop_ref_one primary key (id) -); - create table migtest_e_basic ( id integer generated by default as identity not null, status varchar(1), @@ -291,15 +269,6 @@ alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id forei create index ix_migtest_fk_set_null_one_id on migtest_fk_set_null (one_id); alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id) on delete set null on update restrict; -create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict; - -create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict; - -create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); -alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; - create index ix_migtest_e_basic_eref_id on migtest_e_basic (eref_id); alter table migtest_e_basic add constraint fk_migtest_e_basic_eref_id foreign key (eref_id) references migtest_e_ref (id) on delete restrict on update restrict; 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 a91bf0fe07..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 @@ -11,6 +11,28 @@ drop index if exists ix_migtest_e_basic_indextest1; drop index if exists ix_migtest_e_basic_indextest5; drop index if exists ix_migtest_quoted_status1; -- apply changes +create table drop_main ( + id integer generated by default as identity not null, + constraint pk_drop_main primary key (id) +); + +create table drop_main_drop_ref_many ( + drop_main_id integer not null, + drop_ref_many_id integer not null, + constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) +); + +create table drop_ref_many ( + id integer generated by default as identity not null, + constraint pk_drop_ref_many primary key (id) +); + +create table drop_ref_one ( + id integer generated by default as identity not null, + parent_id integer, + 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), @@ -233,6 +255,15 @@ create view table_with_history as select * from "table" union all select * from create trigger table_history_upd before update,delete on "table" for each row call "io.ebean.platform.h2.H2HistoryTrigger"; alter table "table" add constraint uq_table_select unique ("select"); -- foreign keys and indices +create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict; + +create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict; + +create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); +alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; 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 588dcf115c..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,5 +1,5 @@ -400361768, 1.0__initial.sql -58844973, 1.1.sql +-1854589550, 1.0__initial.sql +-505431855, 1.1.sql 1579867974, 1.2__dropsFor_1.1.sql 64466326, 1.3.sql -232694612, 1.4__dropsFor_1.3.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/hana/1.0__initial.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/hana/1.0__initial.sql index b42347e196..2c41885554 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/hana/1.0__initial.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/hana/1.0__initial.sql @@ -54,28 +54,6 @@ create column table migtest_fk_set_null ( constraint pk_migtest_fk_set_null primary key (id) ); -create column table drop_main ( - id integer generated by default as identity not null, - constraint pk_drop_main primary key (id) -); - -create column table drop_main_drop_ref_many ( - drop_main_id integer not null, - drop_ref_many_id integer not null, - constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) -); - -create column table drop_ref_many ( - id integer generated by default as identity not null, - constraint pk_drop_ref_many primary key (id) -); - -create column table drop_ref_one ( - id integer generated by default as identity not null, - parent_id integer, - constraint pk_drop_ref_one primary key (id) -); - create column table migtest_e_basic ( id integer generated by default as identity not null, status nvarchar(1), @@ -297,15 +275,6 @@ alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id forei -- explicit index "ix_migtest_fk_set_null_one_id" for single column "one_id" of table "migtest_fk_set_null" is not necessary; alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id) on delete set null on update restrict; --- explicit index "ix_drop_main_drop_ref_many_drop_main" for single column "drop_main_id" of table "drop_main_drop_ref_many" is not necessary; -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict; - --- explicit index "ix_drop_main_drop_ref_many_drop_ref_many" for single column "drop_ref_many_id" of table "drop_main_drop_ref_many" is not necessary; -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict; - --- explicit index "ix_drop_ref_one_parent_id" for single column "parent_id" of table "drop_ref_one" is not necessary; -alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; - -- explicit index "ix_migtest_e_basic_eref_id" for single column "eref_id" of table "migtest_e_basic" is not necessary; alter table migtest_e_basic add constraint fk_migtest_e_basic_eref_id foreign key (eref_id) references migtest_e_ref (id) on delete restrict on update restrict; 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 2a5175f4fe..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 @@ -59,6 +59,28 @@ exec 'drop index ix_migtest_quoted_status1'; end; $$; -- apply changes +create column table drop_main ( + id integer generated by default as identity not null, + constraint pk_drop_main primary key (id) +); + +create column table drop_main_drop_ref_many ( + drop_main_id integer not null, + drop_ref_many_id integer not null, + constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) +); + +create column table drop_ref_many ( + id integer generated by default as identity not null, + constraint pk_drop_ref_many primary key (id) +); + +create column table drop_ref_one ( + id integer generated by default as identity not null, + parent_id integer, + 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), @@ -264,6 +286,15 @@ comment on column "table"."index" is 'this is an other comment'; alter table "table" add system versioning history table table_history not validated; -- cannot create unique index "uq_table_select" on table ""table"" with nullable columns; -- foreign keys and indices +-- explicit index "ix_drop_main_drop_ref_many_drop_main" for single column "drop_main_id" of table "drop_main_drop_ref_many" is not necessary; +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict; + +-- explicit index "ix_drop_main_drop_ref_many_drop_ref_many" for single column "drop_ref_many_id" of table "drop_main_drop_ref_many" is not necessary; +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict; + +-- explicit index "ix_drop_ref_one_parent_id" for single column "parent_id" of table "drop_ref_one" is not necessary; +alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; + -- explicit index "ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c" for single column "migtest_mtm_c_id" of table "migtest_mtm_c_migtest_mtm_m" is not necessary; alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; 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 a859ad5d84..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,6 +1,6 @@ -745347271, I__create_procs.sql --1399184401, 1.0__initial.sql --871493688, 1.1.sql +-2017770851, 1.0__initial.sql +2126049978, 1.1.sql 1535221752, 1.2__dropsFor_1.1.sql 1459381570, 1.3.sql -490709749, 1.4__dropsFor_1.3.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/hsqldb/1.0__initial.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/hsqldb/1.0__initial.sql index 90807ee409..ff2f342998 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/hsqldb/1.0__initial.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/hsqldb/1.0__initial.sql @@ -54,28 +54,6 @@ create table migtest_fk_set_null ( constraint pk_migtest_fk_set_null primary key (id) ); -create table drop_main ( - id integer generated by default as identity (start with 1) not null, - constraint pk_drop_main primary key (id) -); - -create table drop_main_drop_ref_many ( - drop_main_id integer not null, - drop_ref_many_id integer not null, - constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) -); - -create table drop_ref_many ( - id integer generated by default as identity (start with 1) not null, - constraint pk_drop_ref_many primary key (id) -); - -create table drop_ref_one ( - id integer generated by default as identity (start with 1) not null, - parent_id integer, - constraint pk_drop_ref_one primary key (id) -); - create table migtest_e_basic ( id integer generated by default as identity (start with 1) not null, status varchar(1), @@ -216,15 +194,6 @@ alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id forei create index ix_migtest_fk_set_null_one_id on migtest_fk_set_null (one_id); alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id) on delete set null on update restrict; -create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict; - -create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict; - -create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); -alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; - create index ix_migtest_e_basic_eref_id on migtest_e_basic (eref_id); alter table migtest_e_basic add constraint fk_migtest_e_basic_eref_id foreign key (eref_id) references migtest_e_ref (id) on delete restrict on update restrict; 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 462cb42e9d..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 @@ -11,6 +11,28 @@ drop index if exists ix_migtest_e_basic_indextest1; drop index if exists ix_migtest_e_basic_indextest5; drop index if exists ix_migtest_quoted_status1; -- apply changes +create table drop_main ( + id integer generated by default as identity (start with 1) not null, + constraint pk_drop_main primary key (id) +); + +create table drop_main_drop_ref_many ( + drop_main_id integer not null, + drop_ref_many_id integer not null, + constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) +); + +create table drop_ref_many ( + id integer generated by default as identity (start with 1) not null, + constraint pk_drop_ref_many primary key (id) +); + +create table drop_ref_one ( + id integer generated by default as identity (start with 1) not null, + parent_id integer, + 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), @@ -189,6 +211,15 @@ comment on table migtest_e_history is 'We have history now'; comment on column "table"."index" is 'this is an other comment'; alter table "table" add constraint uq_table_select unique ("select"); -- foreign keys and indices +create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict; + +create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict; + +create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); +alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; 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 0b9d8c1d1e..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,5 +1,5 @@ -617421105, 1.0__initial.sql --590637714, 1.1.sql +1833930558, 1.0__initial.sql +-432003541, 1.1.sql -848622216, 1.2__dropsFor_1.1.sql -1921508585, 1.3.sql -1547659386, 1.4__dropsFor_1.3.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.0__initial.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.0__initial.sql index 18c10634b2..f9b1b3f43f 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.0__initial.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb-noprocs/1.0__initial.sql @@ -54,28 +54,6 @@ create table migtest_fk_set_null ( constraint pk_migtest_fk_set_null primary key (id) ); -create table drop_main ( - id integer auto_increment not null, - constraint pk_drop_main primary key (id) -); - -create table drop_main_drop_ref_many ( - drop_main_id integer not null, - drop_ref_many_id integer not null, - constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) -); - -create table drop_ref_many ( - id integer auto_increment not null, - constraint pk_drop_ref_many primary key (id) -); - -create table drop_ref_one ( - id integer auto_increment not null, - parent_id integer, - constraint pk_drop_ref_one primary key (id) -); - create table migtest_e_basic ( id integer auto_increment not null, status varchar(1), @@ -217,15 +195,6 @@ alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id forei create index ix_migtest_fk_set_null_one_id on migtest_fk_set_null (one_id); alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id) on delete set null on update restrict; -create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict; - -create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict; - -create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); -alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; - create index ix_migtest_e_basic_eref_id on migtest_e_basic (eref_id); alter table migtest_e_basic add constraint fk_migtest_e_basic_eref_id foreign key (eref_id) references migtest_e_ref (id) on delete restrict on update restrict; 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 ac53c38f74..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 @@ -8,6 +8,28 @@ drop index ix_migtest_e_basic_indextest1 on migtest_e_basic; drop index ix_migtest_e_basic_indextest5 on migtest_e_basic; drop index ix_migtest_quoted_status1 on `migtest_QuOtEd`; -- apply changes +create table drop_main ( + id integer auto_increment not null, + constraint pk_drop_main primary key (id) +); + +create table drop_main_drop_ref_many ( + drop_main_id integer not null, + drop_ref_many_id integer not null, + constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) +); + +create table drop_ref_many ( + id integer auto_increment not null, + constraint pk_drop_ref_many primary key (id) +); + +create table drop_ref_one ( + id integer auto_increment not null, + parent_id integer, + constraint pk_drop_ref_one primary key (id) +); + create table migtest_e_test_binary ( id integer auto_increment not null, test_byte16 varbinary(16), @@ -178,6 +200,15 @@ alter table migtest_e_basic add constraint uq_migtest_e_basic_indextest5 unique alter table migtest_e_history comment = 'We have history now'; alter table `table` add constraint uq_table_select unique (`select`); -- foreign keys and indices +create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict; + +create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict; + +create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); +alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; 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 1ea9b536d8..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,5 +1,5 @@ --1588268581, 1.0__initial.sql --1543277378, 1.1.sql +-2111548334, 1.0__initial.sql +1717242095, 1.1.sql 919151678, 1.2__dropsFor_1.1.sql -413458006, 1.3.sql -177212756, 1.4__dropsFor_1.3.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.0__initial.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.0__initial.sql index 18c10634b2..f9b1b3f43f 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.0__initial.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mariadb/1.0__initial.sql @@ -54,28 +54,6 @@ create table migtest_fk_set_null ( constraint pk_migtest_fk_set_null primary key (id) ); -create table drop_main ( - id integer auto_increment not null, - constraint pk_drop_main primary key (id) -); - -create table drop_main_drop_ref_many ( - drop_main_id integer not null, - drop_ref_many_id integer not null, - constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) -); - -create table drop_ref_many ( - id integer auto_increment not null, - constraint pk_drop_ref_many primary key (id) -); - -create table drop_ref_one ( - id integer auto_increment not null, - parent_id integer, - constraint pk_drop_ref_one primary key (id) -); - create table migtest_e_basic ( id integer auto_increment not null, status varchar(1), @@ -217,15 +195,6 @@ alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id forei create index ix_migtest_fk_set_null_one_id on migtest_fk_set_null (one_id); alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id) on delete set null on update restrict; -create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict; - -create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict; - -create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); -alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; - create index ix_migtest_e_basic_eref_id on migtest_e_basic (eref_id); alter table migtest_e_basic add constraint fk_migtest_e_basic_eref_id foreign key (eref_id) references migtest_e_ref (id) on delete restrict on update restrict; 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 ac53c38f74..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 @@ -8,6 +8,28 @@ drop index ix_migtest_e_basic_indextest1 on migtest_e_basic; drop index ix_migtest_e_basic_indextest5 on migtest_e_basic; drop index ix_migtest_quoted_status1 on `migtest_QuOtEd`; -- apply changes +create table drop_main ( + id integer auto_increment not null, + constraint pk_drop_main primary key (id) +); + +create table drop_main_drop_ref_many ( + drop_main_id integer not null, + drop_ref_many_id integer not null, + constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) +); + +create table drop_ref_many ( + id integer auto_increment not null, + constraint pk_drop_ref_many primary key (id) +); + +create table drop_ref_one ( + id integer auto_increment not null, + parent_id integer, + constraint pk_drop_ref_one primary key (id) +); + create table migtest_e_test_binary ( id integer auto_increment not null, test_byte16 varbinary(16), @@ -178,6 +200,15 @@ alter table migtest_e_basic add constraint uq_migtest_e_basic_indextest5 unique alter table migtest_e_history comment = 'We have history now'; alter table `table` add constraint uq_table_select unique (`select`); -- foreign keys and indices +create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict; + +create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict; + +create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); +alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; 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 34f9b6b377..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,6 +1,6 @@ -1933396282, I__create_procs.sql --1588268581, 1.0__initial.sql --1543277378, 1.1.sql +-2111548334, 1.0__initial.sql +1717242095, 1.1.sql 1187950993, 1.2__dropsFor_1.1.sql -413458006, 1.3.sql -1494509099, 1.4__dropsFor_1.3.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.0__initial.model.xml b/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.0__initial.model.xml index d3b46df240..b0d93151a4 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.0__initial.model.xml +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/model/1.0__initial.model.xml @@ -37,22 +37,6 @@ - - - - - - - - - - - - - - - - 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 c59958a6cb..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 @@ -13,6 +13,22 @@ + + + + + + + + + + + + + + + + diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/1.0__initial.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/1.0__initial.sql index eb95f68166..f2eb08f856 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/1.0__initial.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql/1.0__initial.sql @@ -54,28 +54,6 @@ create table migtest_fk_set_null ( constraint pk_migtest_fk_set_null primary key (id) ); -create table drop_main ( - id integer auto_increment not null, - constraint pk_drop_main primary key (id) -); - -create table drop_main_drop_ref_many ( - drop_main_id integer not null, - drop_ref_many_id integer not null, - constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) -); - -create table drop_ref_many ( - id integer auto_increment not null, - constraint pk_drop_ref_many primary key (id) -); - -create table drop_ref_one ( - id integer auto_increment not null, - parent_id integer, - constraint pk_drop_ref_one primary key (id) -); - create table migtest_e_basic ( id integer auto_increment not null, status varchar(1), @@ -345,15 +323,6 @@ alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id forei create index ix_migtest_fk_set_null_one_id on migtest_fk_set_null (one_id); alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id) on delete set null on update restrict; -create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict; - -create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict; - -create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); -alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; - create index ix_migtest_e_basic_eref_id on migtest_e_basic (eref_id); alter table migtest_e_basic add constraint fk_migtest_e_basic_eref_id foreign key (eref_id) references migtest_e_ref (id) on delete restrict on update restrict; 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 258f31c897..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 @@ -8,6 +8,28 @@ drop index ix_migtest_e_basic_indextest1 on migtest_e_basic; drop index ix_migtest_e_basic_indextest5 on migtest_e_basic; drop index ix_migtest_quoted_status1 on `migtest_QuOtEd`; -- apply changes +create table drop_main ( + id integer auto_increment not null, + constraint pk_drop_main primary key (id) +); + +create table drop_main_drop_ref_many ( + drop_main_id integer not null, + drop_ref_many_id integer not null, + constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) +); + +create table drop_ref_many ( + id integer auto_increment not null, + constraint pk_drop_ref_many primary key (id) +); + +create table drop_ref_one ( + id integer auto_increment not null, + parent_id integer, + constraint pk_drop_ref_one primary key (id) +); + create table migtest_e_test_binary ( id integer auto_increment not null, test_byte16 varbinary(16), @@ -296,6 +318,15 @@ end$$ unlock tables; alter table `table` add constraint uq_table_select unique (`select`); -- foreign keys and indices +create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict; + +create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict; + +create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); +alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; 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 b2fc4d5496..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,6 +1,6 @@ -1933396282, I__create_procs.sql --1156696445, 1.0__initial.sql -1625754872, 1.1.sql +1980830787, 1.0__initial.sql +-847541300, 1.1.sql -1097227916, 1.2__dropsFor_1.1.sql 141196883, 1.3.sql 1044119359, 1.4__dropsFor_1.3.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/1.0__initial.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/1.0__initial.sql index 7e6906ea47..b1db29fc19 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/1.0__initial.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/mysql55/1.0__initial.sql @@ -54,28 +54,6 @@ create table migtest_fk_set_null ( constraint pk_migtest_fk_set_null primary key (id) ); -create table drop_main ( - id integer auto_increment not null, - constraint pk_drop_main primary key (id) -); - -create table drop_main_drop_ref_many ( - drop_main_id integer not null, - drop_ref_many_id integer not null, - constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) -); - -create table drop_ref_many ( - id integer auto_increment not null, - constraint pk_drop_ref_many primary key (id) -); - -create table drop_ref_one ( - id integer auto_increment not null, - parent_id integer, - constraint pk_drop_ref_one primary key (id) -); - create table migtest_e_basic ( id integer auto_increment not null, status varchar(1), @@ -345,15 +323,6 @@ alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id forei create index ix_migtest_fk_set_null_one_id on migtest_fk_set_null (one_id); alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id) on delete set null on update restrict; -create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict; - -create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict; - -create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); -alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; - create index ix_migtest_e_basic_eref_id on migtest_e_basic (eref_id); alter table migtest_e_basic add constraint fk_migtest_e_basic_eref_id foreign key (eref_id) references migtest_e_ref (id) on delete restrict on update restrict; 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 258f31c897..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 @@ -8,6 +8,28 @@ drop index ix_migtest_e_basic_indextest1 on migtest_e_basic; drop index ix_migtest_e_basic_indextest5 on migtest_e_basic; drop index ix_migtest_quoted_status1 on `migtest_QuOtEd`; -- apply changes +create table drop_main ( + id integer auto_increment not null, + constraint pk_drop_main primary key (id) +); + +create table drop_main_drop_ref_many ( + drop_main_id integer not null, + drop_ref_many_id integer not null, + constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) +); + +create table drop_ref_many ( + id integer auto_increment not null, + constraint pk_drop_ref_many primary key (id) +); + +create table drop_ref_one ( + id integer auto_increment not null, + parent_id integer, + constraint pk_drop_ref_one primary key (id) +); + create table migtest_e_test_binary ( id integer auto_increment not null, test_byte16 varbinary(16), @@ -296,6 +318,15 @@ end$$ unlock tables; alter table `table` add constraint uq_table_select unique (`select`); -- foreign keys and indices +create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict; + +create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict; + +create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); +alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; 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 35f9d5e0b9..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,6 +1,6 @@ -1933396282, I__create_procs.sql --165038024, 1.0__initial.sql -1625754872, 1.1.sql +369577572, 1.0__initial.sql +-847541300, 1.1.sql -1097227916, 1.2__dropsFor_1.1.sql 141196883, 1.3.sql 1044119359, 1.4__dropsFor_1.3.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/nuodb/1.0__initial.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/nuodb/1.0__initial.sql index 58cfc41bb1..b5d81c5bd2 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/nuodb/1.0__initial.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/nuodb/1.0__initial.sql @@ -54,28 +54,6 @@ create table migtest_fk_set_null ( constraint pk_migtest_fk_set_null primary key (id) ); -create table drop_main ( - id integer generated by default as identity not null, - constraint pk_drop_main primary key (id) -); - -create table drop_main_drop_ref_many ( - drop_main_id integer not null, - drop_ref_many_id integer not null, - constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) -); - -create table drop_ref_many ( - id integer generated by default as identity not null, - constraint pk_drop_ref_many primary key (id) -); - -create table drop_ref_one ( - id integer generated by default as identity not null, - parent_id integer, - constraint pk_drop_ref_one primary key (id) -); - create table migtest_e_basic ( id integer generated by default as identity not null, status varchar(1), @@ -362,15 +340,6 @@ alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id forei create index ix_migtest_fk_set_null_one_id on migtest_fk_set_null (one_id); alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id); -create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id); - -create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id); - -create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); -alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id); - create index ix_migtest_e_basic_eref_id on migtest_e_basic (eref_id); alter table migtest_e_basic add constraint fk_migtest_e_basic_eref_id foreign key (eref_id) references migtest_e_ref (id); 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 935d3d7d2a..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 @@ -11,6 +11,28 @@ drop index if exists ix_migtest_e_basic_indextest1; drop index if exists ix_migtest_e_basic_indextest5; drop index if exists ix_migtest_quoted_status1; -- apply changes +create table drop_main ( + id integer generated by default as identity not null, + constraint pk_drop_main primary key (id) +); + +create table drop_main_drop_ref_many ( + drop_main_id integer not null, + drop_ref_many_id integer not null, + constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) +); + +create table drop_ref_many ( + id integer generated by default as identity not null, + constraint pk_drop_ref_many primary key (id) +); + +create table drop_ref_one ( + id integer generated by default as identity not null, + parent_id integer, + 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), @@ -320,6 +342,15 @@ $$ alter table "table" add constraint uq_table_select unique ("select"); -- foreign keys and indices +create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id); + +create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id); + +create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); +alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id); + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id); 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 312205fd4d..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,5 +1,5 @@ --588780599, 1.0__initial.sql --2132614794, 1.1.sql +390216918, 1.0__initial.sql +-303196611, 1.1.sql 1530685455, 1.2__dropsFor_1.1.sql -956168377, 1.3.sql 1047623430, 1.4__dropsFor_1.3.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/oracle/1.0__initial.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/oracle/1.0__initial.sql index a976889264..4b2f1f9a57 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/oracle/1.0__initial.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/oracle/1.0__initial.sql @@ -54,28 +54,6 @@ create table migtest_fk_set_null ( constraint pk_migtest_fk_set_null primary key (id) ); -create table drop_main ( - id number(10) generated by default as identity not null, - constraint pk_drop_main primary key (id) -); - -create table drop_main_drop_ref_many ( - drop_main_id number(10) not null, - drop_ref_many_id number(10) not null, - constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) -); - -create table drop_ref_many ( - id number(10) generated by default as identity not null, - constraint pk_drop_ref_many primary key (id) -); - -create table drop_ref_one ( - id number(10) generated by default as identity not null, - parent_id number(10), - constraint pk_drop_ref_one primary key (id) -); - create table migtest_e_basic ( id number(10) generated by default as identity not null, status varchar2(1), @@ -216,15 +194,6 @@ alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id forei create index ix_migtest_fk_set_null_one_id on migtest_fk_set_null (one_id); alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id) on delete set null; -create index ix_drp_mn_drp_rf_mny_drp_mn on drop_main_drop_ref_many (drop_main_id); -alter table drop_main_drop_ref_many add constraint fk_drp_mn_drp_rf_mny_drp_mn foreign key (drop_main_id) references drop_main (id); - -create index ix_drp_mn_drp_rf_mny_dr_d70vl on drop_main_drop_ref_many (drop_ref_many_id); -alter table drop_main_drop_ref_many add constraint fk_drp_mn_drp_rf_mny_dr_joeslj foreign key (drop_ref_many_id) references drop_ref_many (id); - -create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); -alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id); - create index ix_migtest_e_basic_eref_id on migtest_e_basic (eref_id); alter table migtest_e_basic add constraint fk_migtest_e_basic_eref_id foreign key (eref_id) references migtest_e_ref (id); 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 5061df2386..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 @@ -56,6 +56,28 @@ drop index ix_migtest_e_basic_indextest1; drop index ix_migtest_e_basic_indextest5; drop index ix_migtest_quoted_status1; -- apply changes +create table drop_main ( + id number(10) generated by default as identity not null, + constraint pk_drop_main primary key (id) +); + +create table drop_main_drop_ref_many ( + drop_main_id number(10) not null, + drop_ref_many_id number(10) not null, + constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) +); + +create table drop_ref_many ( + id number(10) generated by default as identity not null, + constraint pk_drop_ref_many primary key (id) +); + +create table drop_ref_one ( + id number(10) generated by default as identity not null, + parent_id number(10), + 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), @@ -234,6 +256,15 @@ comment on table migtest_e_history is 'We have history now'; comment on column "table"."index" is 'this is an other comment'; -- NOT YET IMPLEMENTED: alter table "table" add constraint uq_table_select unique ("select"); -- foreign keys and indices +create index ix_drp_mn_drp_rf_mny_drp_mn on drop_main_drop_ref_many (drop_main_id); +alter table drop_main_drop_ref_many add constraint fk_drp_mn_drp_rf_mny_drp_mn foreign key (drop_main_id) references drop_main (id); + +create index ix_drp_mn_drp_rf_mny_dr_d70vl on drop_main_drop_ref_many (drop_ref_many_id); +alter table drop_main_drop_ref_many add constraint fk_drp_mn_drp_rf_mny_dr_joeslj foreign key (drop_ref_many_id) references drop_ref_many (id); + +create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); +alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id); + create index ix_mgtst_mtm_c_mgtst_mt_3ug4ok on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_mgtst_mtm_c_mgtst_mt_93awga foreign key (migtest_mtm_c_id) references migtest_mtm_c (id); 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 83f0e9e91d..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,5 +1,5 @@ --126940583, 1.0__initial.sql --1646771053, 1.1.sql +1757923548, 1.0__initial.sql +-1862781653, 1.1.sql 930172034, 1.2__dropsFor_1.1.sql -647790612, 1.3.sql -116456403, 1.4__dropsFor_1.3.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/oracle11/1.0__initial.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/oracle11/1.0__initial.sql index 3d4518972b..bfbc238c45 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/oracle11/1.0__initial.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/oracle11/1.0__initial.sql @@ -62,31 +62,6 @@ create table migtest_fk_set_null ( ); create sequence migtest_fk_set_null_seq; -create table drop_main ( - id number(10) not null, - constraint pk_drop_main primary key (id) -); -create sequence drop_main_seq; - -create table drop_main_drop_ref_many ( - drop_main_id number(10) not null, - drop_ref_many_id number(10) not null, - constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) -); - -create table drop_ref_many ( - id number(10) not null, - constraint pk_drop_ref_many primary key (id) -); -create sequence drop_ref_many_seq; - -create table drop_ref_one ( - id number(10) not null, - parent_id number(10), - constraint pk_drop_ref_one primary key (id) -); -create sequence drop_ref_one_seq; - create table migtest_e_basic ( id number(10) not null, status varchar2(1), @@ -241,15 +216,6 @@ alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id forei create index ix_migtest_fk_set_null_one_id on migtest_fk_set_null (one_id); alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id) on delete set null; -create index ix_drp_mn_drp_rf_mny_drp_mn on drop_main_drop_ref_many (drop_main_id); -alter table drop_main_drop_ref_many add constraint fk_drp_mn_drp_rf_mny_drp_mn foreign key (drop_main_id) references drop_main (id); - -create index ix_drp_mn_drp_rf_mny_dr_d70vl on drop_main_drop_ref_many (drop_ref_many_id); -alter table drop_main_drop_ref_many add constraint fk_drp_mn_drp_rf_mny_dr_joeslj foreign key (drop_ref_many_id) references drop_ref_many (id); - -create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); -alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id); - create index ix_migtest_e_basic_eref_id on migtest_e_basic (eref_id); alter table migtest_e_basic add constraint fk_migtest_e_basic_eref_id foreign key (eref_id) references migtest_e_ref (id); 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 bf0f4278ed..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 @@ -56,6 +56,31 @@ drop index ix_migtest_e_basic_indextest1; drop index ix_migtest_e_basic_indextest5; drop index ix_migtest_quoted_status1; -- apply changes +create table drop_main ( + id number(10) not null, + constraint pk_drop_main primary key (id) +); +create sequence drop_main_seq; + +create table drop_main_drop_ref_many ( + drop_main_id number(10) not null, + drop_ref_many_id number(10) not null, + constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) +); + +create table drop_ref_many ( + id number(10) not null, + constraint pk_drop_ref_many primary key (id) +); +create sequence drop_ref_many_seq; + +create table drop_ref_one ( + id number(10) not null, + parent_id number(10), + constraint pk_drop_ref_one primary key (id) +); +create sequence drop_ref_one_seq; + create table migtest_e_test_binary ( id number(10) not null, test_byte16 raw(16), @@ -239,6 +264,15 @@ comment on table migtest_e_history is 'We have history now'; comment on column "table"."index" is 'this is an other comment'; -- NOT YET IMPLEMENTED: alter table "table" add constraint uq_table_select unique ("select"); -- foreign keys and indices +create index ix_drp_mn_drp_rf_mny_drp_mn on drop_main_drop_ref_many (drop_main_id); +alter table drop_main_drop_ref_many add constraint fk_drp_mn_drp_rf_mny_drp_mn foreign key (drop_main_id) references drop_main (id); + +create index ix_drp_mn_drp_rf_mny_dr_d70vl on drop_main_drop_ref_many (drop_ref_many_id); +alter table drop_main_drop_ref_many add constraint fk_drp_mn_drp_rf_mny_dr_joeslj foreign key (drop_ref_many_id) references drop_ref_many (id); + +create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); +alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id); + create index ix_mgtst_mtm_c_mgtst_mt_3ug4ok on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_mgtst_mtm_c_mgtst_mt_93awga foreign key (migtest_mtm_c_id) references migtest_mtm_c (id); 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 d9f99e4a35..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,5 +1,5 @@ -21261569, 1.0__initial.sql --772002701, 1.1.sql +-1422254768, 1.0__initial.sql +661141209, 1.1.sql 930172034, 1.2__dropsFor_1.1.sql 1369863782, 1.3.sql -116456403, 1.4__dropsFor_1.3.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.0__initial.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.0__initial.sql index eaff8a84d9..acc4504bc8 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.0__initial.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres/1.0__initial.sql @@ -54,28 +54,6 @@ create table migtest_fk_set_null ( constraint pk_migtest_fk_set_null primary key (id) ); -create table drop_main ( - id integer generated by default as identity not null, - constraint pk_drop_main primary key (id) -); - -create table drop_main_drop_ref_many ( - drop_main_id integer not null, - drop_ref_many_id integer not null, - constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) -); - -create table drop_ref_many ( - id integer generated by default as identity not null, - constraint pk_drop_ref_many primary key (id) -); - -create table drop_ref_one ( - id integer generated by default as identity not null, - parent_id integer, - constraint pk_drop_ref_one primary key (id) -); - create table migtest_e_basic ( id integer generated by default as identity not null, description_file bytea, @@ -374,15 +352,6 @@ alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id forei create index ix_migtest_fk_set_null_one_id on migtest_fk_set_null (one_id); alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id) on delete set null on update restrict; -create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict; - -create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict; - -create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); -alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; - create index ix_migtest_e_basic_eref_id on migtest_e_basic (eref_id); alter table migtest_e_basic add constraint fk_migtest_e_basic_eref_id foreign key (eref_id) references migtest_e_ref (id) on delete restrict on update restrict; 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 d2fa145da9..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 @@ -14,6 +14,28 @@ drop index if exists idxd_migtest_0; drop index concurrently if exists ix_migtest_oto_child_lowername_id; drop index if exists ix_migtest_oto_child_lowername; -- apply changes +create table drop_main ( + id integer generated by default as identity not null, + constraint pk_drop_main primary key (id) +); + +create table drop_main_drop_ref_many ( + drop_main_id integer not null, + drop_ref_many_id integer not null, + constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) +); + +create table drop_ref_many ( + id integer generated by default as identity not null, + constraint pk_drop_ref_many primary key (id) +); + +create table drop_ref_one ( + id integer generated by default as identity not null, + parent_id integer, + 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, @@ -391,6 +413,15 @@ create trigger table_history_upd alter table "table" add constraint uq_table_select unique ("select"); -- foreign keys and indices +create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict; + +create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict; + +create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); +alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; 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 42f2974d3b..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,5 +1,5 @@ --22203872, 1.0__initial.sql --449527326, 1.1.sql +1942370812, 1.0__initial.sql +-150823045, 1.1.sql -261111052, 1.2__dropsFor_1.1.sql 788727457, 1.3.sql -1352224731, 1.4__dropsFor_1.3.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.0__initial.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.0__initial.sql index af6cf0911c..e91b2b1c3d 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.0__initial.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/postgres9/1.0__initial.sql @@ -54,28 +54,6 @@ create table migtest_fk_set_null ( constraint pk_migtest_fk_set_null primary key (id) ); -create table drop_main ( - id serial not null, - constraint pk_drop_main primary key (id) -); - -create table drop_main_drop_ref_many ( - drop_main_id integer not null, - drop_ref_many_id integer not null, - constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) -); - -create table drop_ref_many ( - id serial not null, - constraint pk_drop_ref_many primary key (id) -); - -create table drop_ref_one ( - id serial not null, - parent_id integer, - constraint pk_drop_ref_one primary key (id) -); - create table migtest_e_basic ( id serial not null, description_file bytea, @@ -374,15 +352,6 @@ alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id forei create index ix_migtest_fk_set_null_one_id on migtest_fk_set_null (one_id); alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id) on delete set null on update restrict; -create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict; - -create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict; - -create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); -alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; - create index ix_migtest_e_basic_eref_id on migtest_e_basic (eref_id); alter table migtest_e_basic add constraint fk_migtest_e_basic_eref_id foreign key (eref_id) references migtest_e_ref (id) on delete restrict on update restrict; 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 8f131d01ef..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 @@ -14,6 +14,28 @@ drop index if exists idxd_migtest_0; drop index concurrently if exists ix_migtest_oto_child_lowername_id; drop index if exists ix_migtest_oto_child_lowername; -- apply changes +create table drop_main ( + id serial not null, + constraint pk_drop_main primary key (id) +); + +create table drop_main_drop_ref_many ( + drop_main_id integer not null, + drop_ref_many_id integer not null, + constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) +); + +create table drop_ref_many ( + id serial not null, + constraint pk_drop_ref_many primary key (id) +); + +create table drop_ref_one ( + id serial not null, + parent_id integer, + constraint pk_drop_ref_one primary key (id) +); + create table migtest_e_test_binary ( id serial not null, test_byte16 bytea, @@ -391,6 +413,15 @@ create trigger table_history_upd alter table "table" add constraint uq_table_select unique ("select"); -- foreign keys and indices +create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict; + +create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict; + +create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); +alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; 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 f75bfffc3b..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,5 +1,5 @@ -559327334, 1.0__initial.sql --788518640, 1.1.sql +-1015076364, 1.0__initial.sql +328269371, 1.1.sql -261111052, 1.2__dropsFor_1.1.sql -1811829200, 1.3.sql -1352224731, 1.4__dropsFor_1.3.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 9def166785..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 @@ -54,28 +54,6 @@ create table migtest_fk_set_null ( constraint pk_migtest_fk_set_null primary key (id) ); -create table drop_main ( - id integer auto_increment not null, - constraint pk_drop_main primary key (id) -); - -create table drop_main_drop_ref_many ( - drop_main_id integer not null, - drop_ref_many_id integer not null, - constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) -); - -create table drop_ref_many ( - id integer auto_increment not null, - constraint pk_drop_ref_many primary key (id) -); - -create table drop_ref_one ( - id integer auto_increment not null, - parent_id integer, - constraint pk_drop_ref_one primary key (id) -); - create table migtest_e_basic ( id integer auto_increment not null, status varchar(1), @@ -216,15 +194,6 @@ alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id forei create index ix_migtest_fk_set_null_one_id on migtest_fk_set_null (one_id); alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id) on delete set null on update restrict; -create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict; - -create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict; - -create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); -alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; - create index ix_migtest_e_basic_eref_id on migtest_e_basic (eref_id); alter table migtest_e_basic add constraint fk_migtest_e_basic_eref_id foreign key (eref_id) references migtest_e_ref (id) on delete restrict on update restrict; 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 13cd0ce15a..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 @@ -11,6 +11,28 @@ drop index if exists ix_migtest_e_basic_indextest1; drop index if exists ix_migtest_e_basic_indextest5; drop index if exists ix_migtest_quoted_status1; -- apply changes +create table drop_main ( + id integer auto_increment not null, + constraint pk_drop_main primary key (id) +); + +create table drop_main_drop_ref_many ( + drop_main_id integer not null, + drop_ref_many_id integer not null, + constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) +); + +create table drop_ref_many ( + id integer auto_increment not null, + constraint pk_drop_ref_many primary key (id) +); + +create table drop_ref_one ( + id integer auto_increment not null, + parent_id integer, + constraint pk_drop_ref_one primary key (id) +); + create table migtest_e_test_binary ( id integer auto_increment not null, test_byte16 varbinary(16), @@ -189,6 +211,15 @@ comment on table migtest_e_history is 'We have history now'; comment on column "table"."index" is 'this is an other comment'; alter table "table" add constraint uq_table_select unique ("select"); -- foreign keys and indices +create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict; + +create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict; + +create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); +alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; 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 07b9f09320..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,5 +1,5 @@ -1999303200, 1.0__initial.sql --2053964976, 1.1.sql +-391639901, 1.0__initial.sql +974884972, 1.1.sql 688811494, 1.2__dropsFor_1.1.sql 1199670482, 1.3.sql -252580551, 1.4__dropsFor_1.3.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlite/1.0__initial.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlite/1.0__initial.sql index dbb047e574..bfd05a961c 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlite/1.0__initial.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlite/1.0__initial.sql @@ -56,31 +56,6 @@ create table migtest_fk_set_null ( foreign key (one_id) references migtest_fk_one (id) on delete set null on update restrict ); -create table drop_main ( - id integer not null, - constraint pk_drop_main primary key (id) -); - -create table drop_main_drop_ref_many ( - drop_main_id integer not null, - drop_ref_many_id integer not null, - constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id), - foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict, - foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict -); - -create table drop_ref_many ( - id integer not null, - constraint pk_drop_ref_many primary key (id) -); - -create table drop_ref_one ( - id integer not null, - parent_id integer, - constraint pk_drop_ref_one primary key (id), - foreign key (parent_id) references drop_main (id) on delete restrict on update restrict -); - create table migtest_e_basic ( id integer not null, status varchar(1), 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 7d06abefa5..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 @@ -11,6 +11,31 @@ drop index if exists ix_migtest_e_basic_indextest1; drop index if exists ix_migtest_e_basic_indextest5; drop index if exists ix_migtest_quoted_status1; -- apply changes +create table drop_main ( + id integer not null, + constraint pk_drop_main primary key (id) +); + +create table drop_main_drop_ref_many ( + drop_main_id integer not null, + drop_ref_many_id integer not null, + constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id), + foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict, + foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict +); + +create table drop_ref_many ( + id integer not null, + constraint pk_drop_ref_many primary key (id) +); + +create table drop_ref_one ( + id integer not null, + parent_id integer, + constraint pk_drop_ref_one primary key (id), + 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), 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 9b70e29fd3..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,5 +1,5 @@ -238997470, 1.0__initial.sql --456448682, 1.1.sql +-1527127682, 1.0__initial.sql +-321125092, 1.1.sql 688811494, 1.2__dropsFor_1.1.sql 142780650, 1.3.sql -252580551, 1.4__dropsFor_1.3.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/1.0__initial.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/1.0__initial.sql index 52b69c27fe..00b472a4bc 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/1.0__initial.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/sqlserver16/1.0__initial.sql @@ -54,28 +54,6 @@ create table migtest_fk_set_null ( constraint pk_migtest_fk_set_null primary key (id) ); -create table drop_main ( - id integer identity(1,1) not null, - constraint pk_drop_main primary key (id) -); - -create table drop_main_drop_ref_many ( - drop_main_id integer not null, - drop_ref_many_id integer not null, - constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) -); - -create table drop_ref_many ( - id integer identity(1,1) not null, - constraint pk_drop_ref_many primary key (id) -); - -create table drop_ref_one ( - id integer identity(1,1) not null, - parent_id integer, - constraint pk_drop_ref_one primary key (id) -); - create table migtest_e_basic ( id integer identity(1,1) not null, status varchar(1), @@ -246,15 +224,6 @@ alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id forei create index ix_migtest_fk_set_null_one_id on migtest_fk_set_null (one_id); alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id) on delete set null; -create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id); - -create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id); - -create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); -alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id); - create index ix_migtest_e_basic_eref_id on migtest_e_basic (eref_id); alter table migtest_e_basic add constraint fk_migtest_e_basic_eref_id foreign key (eref_id) references migtest_e_ref (id); 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 69366b52c5..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 @@ -13,6 +13,28 @@ IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('migtest_e_b IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('migtest_e_basic','U') AND name = 'ix_migtest_e_basic_indextest5') drop index ix_migtest_e_basic_indextest5 ON migtest_e_basic; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('"migtest_QuOtEd"','U') AND name = 'ix_migtest_quoted_status1') drop index ix_migtest_quoted_status1 ON "migtest_QuOtEd"; -- apply changes +create table drop_main ( + id integer identity(1,1) not null, + constraint pk_drop_main primary key (id) +); + +create table drop_main_drop_ref_many ( + drop_main_id integer not null, + drop_ref_many_id integer not null, + constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) +); + +create table drop_ref_many ( + id integer identity(1,1) not null, + constraint pk_drop_ref_many primary key (id) +); + +create table drop_ref_one ( + id integer identity(1,1) not null, + parent_id integer, + constraint pk_drop_ref_one primary key (id) +); + create table migtest_e_test_binary ( id integer identity(1,1) not null, test_byte16 image, @@ -213,6 +235,15 @@ period for system_time (sys_periodFrom, sys_periodTo); alter table migtest_e_history set (system_versioning = on (history_table=dbo.migtest_e_history_history)); create unique nonclustered index uq_table_select on "table"("select") where "select" is not null; -- foreign keys and indices +create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id); + +create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id); + +create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); +alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id); + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id); 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 7917299b42..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,6 +1,6 @@ 891357544, I__create_procs.sql -254353963, 1.0__initial.sql -262569028, 1.1.sql +-1455820494, 1.0__initial.sql +-88313995, 1.1.sql -1431095657, 1.2__dropsFor_1.1.sql 1846195516, 1.3.sql -225579996, 1.4__dropsFor_1.3.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 a08c714056..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 @@ -62,31 +62,6 @@ create table migtest_fk_set_null ( ); create sequence migtest_fk_set_null_seq as bigint start with 1; -create table drop_main ( - id integer not null, - constraint pk_drop_main primary key (id) -); -create sequence drop_main_seq as bigint start with 1; - -create table drop_main_drop_ref_many ( - drop_main_id integer not null, - drop_ref_many_id integer not null, - constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) -); - -create table drop_ref_many ( - id integer not null, - constraint pk_drop_ref_many primary key (id) -); -create sequence drop_ref_many_seq as bigint start with 1; - -create table drop_ref_one ( - id integer not null, - parent_id integer, - constraint pk_drop_ref_one primary key (id) -); -create sequence drop_ref_one_seq as bigint start with 1; - create table migtest_e_basic ( id integer not null, status nvarchar(1), @@ -271,15 +246,6 @@ alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id forei create index ix_migtest_fk_set_null_one_id on migtest_fk_set_null (one_id); alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id) on delete set null; -create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id); - -create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id); - -create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); -alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id); - create index ix_migtest_e_basic_eref_id on migtest_e_basic (eref_id); alter table migtest_e_basic add constraint fk_migtest_e_basic_eref_id foreign key (eref_id) references migtest_e_ref (id); 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 dc3bb06afb..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 @@ -13,6 +13,31 @@ IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('migtest_e_b IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('migtest_e_basic','U') AND name = 'ix_migtest_e_basic_indextest5') drop index ix_migtest_e_basic_indextest5 ON migtest_e_basic; IF EXISTS (SELECT name FROM sys.indexes WHERE object_id = OBJECT_ID('"migtest_QuOtEd"','U') AND name = 'ix_migtest_quoted_status1') drop index ix_migtest_quoted_status1 ON "migtest_QuOtEd"; -- apply changes +create table drop_main ( + id integer not null, + constraint pk_drop_main primary key (id) +); +create sequence drop_main_seq as bigint start with 1; + +create table drop_main_drop_ref_many ( + drop_main_id integer not null, + drop_ref_many_id integer not null, + constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) +); + +create table drop_ref_many ( + id integer not null, + constraint pk_drop_ref_many primary key (id) +); +create sequence drop_ref_many_seq as bigint start with 1; + +create table drop_ref_one ( + id integer not null, + parent_id integer, + constraint pk_drop_ref_one primary key (id) +); +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), @@ -218,6 +243,15 @@ period for system_time (sys_periodFrom, sys_periodTo); alter table migtest_e_history set (system_versioning = on (history_table=dbo.migtest_e_history_history)); create unique nonclustered index uq_table_select on "table"("select") where "select" is not null; -- foreign keys and indices +create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id); + +create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id); + +create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); +alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id); + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id); 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 73f6f67d43..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,6 +1,6 @@ 891357544, I__create_procs.sql -105089711, 1.0__initial.sql -307269467, 1.1.sql +1574627056, 1.0__initial.sql +1681608861, 1.1.sql -1431095657, 1.2__dropsFor_1.1.sql 486442698, 1.3.sql -225579996, 1.4__dropsFor_1.3.sql diff --git a/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.0__initial.sql b/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.0__initial.sql index 71e9271753..1dbcc0776b 100644 --- a/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.0__initial.sql +++ b/ebean-test/src/test/resources/migrationtest/dbmigration/yugabyte/1.0__initial.sql @@ -54,28 +54,6 @@ create table migtest_fk_set_null ( constraint pk_migtest_fk_set_null primary key (id) ); -create table drop_main ( - id integer generated by default as identity not null, - constraint pk_drop_main primary key (id) -); - -create table drop_main_drop_ref_many ( - drop_main_id integer not null, - drop_ref_many_id integer not null, - constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) -); - -create table drop_ref_many ( - id integer generated by default as identity not null, - constraint pk_drop_ref_many primary key (id) -); - -create table drop_ref_one ( - id integer generated by default as identity not null, - parent_id integer, - constraint pk_drop_ref_one primary key (id) -); - create table migtest_e_basic ( id integer generated by default as identity not null, status varchar(1), @@ -405,15 +383,6 @@ alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id forei create index ix_migtest_fk_set_null_one_id on migtest_fk_set_null (one_id); alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id) on delete set null on update restrict; -create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict; - -create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); -alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict; - -create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); -alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; - create index ix_migtest_e_basic_eref_id on migtest_e_basic (eref_id); alter table migtest_e_basic add constraint fk_migtest_e_basic_eref_id foreign key (eref_id) references migtest_e_ref (id) on delete restrict on update restrict; 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 40fe12382f..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 @@ -11,6 +11,28 @@ drop index if exists ix_migtest_e_basic_indextest1; drop index if exists ix_migtest_e_basic_indextest5; drop index if exists ix_migtest_quoted_status1; -- apply changes +create table drop_main ( + id integer generated by default as identity not null, + constraint pk_drop_main primary key (id) +); + +create table drop_main_drop_ref_many ( + drop_main_id integer not null, + drop_ref_many_id integer not null, + constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id) +); + +create table drop_ref_many ( + id integer generated by default as identity not null, + constraint pk_drop_ref_many primary key (id) +); + +create table drop_ref_one ( + id integer generated by default as identity not null, + parent_id integer, + 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, @@ -390,6 +412,15 @@ create trigger table_history_upd alter table "table" add constraint uq_table_select unique ("select"); -- foreign keys and indices +create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict; + +create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id); +alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict; + +create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id); +alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict; + create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id); alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict; 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 fbf47fa64a..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,5 +1,5 @@ -1799266243, 1.0__initial.sql -1695259133, 1.1.sql +-1646972843, 1.0__initial.sql +1912842724, 1.1.sql -261111052, 1.2__dropsFor_1.1.sql -526466104, 1.3.sql -1352224731, 1.4__dropsFor_1.3.sql