diff --git a/pom.xml b/pom.xml index 05d2f4b10..0b8c9e0a2 100644 --- a/pom.xml +++ b/pom.xml @@ -229,7 +229,7 @@ io.ebean.test ebean-test-docker - 2.4.1 + 2.5.1 test diff --git a/src/main/resources/io/ebeaninternal/dbmigration/builtin-extra-ddl.xml b/src/main/resources/io/ebeaninternal/dbmigration/builtin-extra-ddl.xml index d50eef8b6..5a11d4804 100644 --- a/src/main/resources/io/ebeaninternal/dbmigration/builtin-extra-ddl.xml +++ b/src/main/resources/io/ebeaninternal/dbmigration/builtin-extra-ddl.xml @@ -49,11 +49,11 @@ CREATE OR ALTER PROCEDURE usp_ebean_drop_default_constraint @tableName nvarchar( AS SET NOCOUNT ON declare @tmp nvarchar(1000) BEGIN - select @Tmp = t1.name from sys.default_constraints t1 + select @tmp = t1.name from sys.default_constraints t1 join sys.columns t2 on t1.object_id = t2.default_object_id where t1.parent_object_id = OBJECT_ID(@tableName) and t2.name = @columnName; - if @Tmp is not null EXEC('alter table ' + @tableName +' drop constraint ' + @tmp); + if @tmp is not null EXEC('alter table ' + @tableName +' drop constraint ' + @tmp); END $$ @@ -171,13 +171,13 @@ AS BEGIN DECLARE foreign_key_names TABLE(CONSTRAINT_NAME NVARCHAR(256), TABLE_NAME NVARCHAR(256)); DECLARE i INT; - + foreign_key_names = SELECT CONSTRAINT_NAME, TABLE_NAME FROM SYS.REFERENTIAL_CONSTRAINTS WHERE SCHEMA_NAME=CURRENT_SCHEMA AND TABLE_NAME=UPPER(:table_name) AND COLUMN_NAME=UPPER(:column_name); - + FOR I IN 1 .. RECORD_COUNT(:foreign_key_names) DO EXEC 'ALTER TABLE "' || ESCAPE_DOUBLE_QUOTES(:foreign_key_names.TABLE_NAME[i]) || '" DROP CONSTRAINT "' || ESCAPE_DOUBLE_QUOTES(:foreign_key_names.CONSTRAINT_NAME[i]) || '"'; END FOR; - + END; $$ diff --git a/src/test/java/main/StartSqlServer.java b/src/test/java/main/StartSqlServer.java index fe758efba..a158133ae 100644 --- a/src/test/java/main/StartSqlServer.java +++ b/src/test/java/main/StartSqlServer.java @@ -11,9 +11,15 @@ public class StartSqlServer { config.setDbName("test_ebean"); config.setUser("test_ebean"); + // by default this sqlserver docker collation is case sensitive + // using MSSQL_COLLATION=Latin1_General_100_BIN2 + // + // when changing to a CI collation also use + // ebean.sqlserver.caseSensitiveCollation=false + // ... such that tests now take that into account + //config.setCollation("Latin1_General_100_CI"); SqlServerContainer container = new SqlServerContainer(config); container.start(); - } } diff --git a/src/test/resources/dbmigration/migrationtest/hana/I__create_procs.sql b/src/test/resources/dbmigration/migrationtest/hana/I__create_procs.sql index 6abbe7a96..32b8a9404 100644 --- a/src/test/resources/dbmigration/migrationtest/hana/I__create_procs.sql +++ b/src/test/resources/dbmigration/migrationtest/hana/I__create_procs.sql @@ -9,13 +9,13 @@ AS BEGIN DECLARE foreign_key_names TABLE(CONSTRAINT_NAME NVARCHAR(256), TABLE_NAME NVARCHAR(256)); DECLARE i INT; - + foreign_key_names = SELECT CONSTRAINT_NAME, TABLE_NAME FROM SYS.REFERENTIAL_CONSTRAINTS WHERE SCHEMA_NAME=CURRENT_SCHEMA AND TABLE_NAME=UPPER(:table_name) AND COLUMN_NAME=UPPER(:column_name); - + FOR I IN 1 .. RECORD_COUNT(:foreign_key_names) DO EXEC 'ALTER TABLE "' || ESCAPE_DOUBLE_QUOTES(:foreign_key_names.TABLE_NAME[i]) || '" DROP CONSTRAINT "' || ESCAPE_DOUBLE_QUOTES(:foreign_key_names.CONSTRAINT_NAME[i]) || '"'; END FOR; - + END; $$ diff --git a/src/test/resources/dbmigration/migrationtest/sqlserver17/I__create_procs.sql b/src/test/resources/dbmigration/migrationtest/sqlserver17/I__create_procs.sql index 5c35dffc6..0d6379544 100644 --- a/src/test/resources/dbmigration/migrationtest/sqlserver17/I__create_procs.sql +++ b/src/test/resources/dbmigration/migrationtest/sqlserver17/I__create_procs.sql @@ -46,11 +46,11 @@ CREATE OR ALTER PROCEDURE usp_ebean_drop_default_constraint @tableName nvarchar( AS SET NOCOUNT ON declare @tmp nvarchar(1000) BEGIN - select @Tmp = t1.name from sys.default_constraints t1 + select @tmp = t1.name from sys.default_constraints t1 join sys.columns t2 on t1.object_id = t2.default_object_id where t1.parent_object_id = OBJECT_ID(@tableName) and t2.name = @columnName; - if @Tmp is not null EXEC('alter table ' + @tableName +' drop constraint ' + @tmp); + if @tmp is not null EXEC('alter table ' + @tableName +' drop constraint ' + @tmp); END $$ diff --git a/src/test/resources/ebean.properties b/src/test/resources/ebean.properties index 7fdded46b..3943c47f4 100644 --- a/src/test/resources/ebean.properties +++ b/src/test/resources/ebean.properties @@ -161,8 +161,8 @@ datasource.pg.maxStackTraceSize=50 ebean.sqlserver.databasePlatformName=sqlserver17 # set caseSensitiveCollation=false when using a -# case insenstive collation with sql server -ebean.sqlserver.caseSensitiveCollation=false +# case insenstive collation with sql server - See main.StartSqlServer +#ebean.sqlserver.caseSensitiveCollation=false datasource.sqlserver.username=test_ebean datasource.sqlserver.password=SqlS3rv#r datasource.sqlserver.url=jdbc:sqlserver://localhost:1433;databaseName=test_ebean;sendTimeAsDateTime=false