Skip to content

Commit 34e883c

Browse files
authored
Fix H2 tests after latest merge for H2 generate schema changes (#2964)
* Fix H2 tests after latest merge for H2 generate schema changes This PR had test failures: #1789
1 parent 2dc5153 commit 34e883c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

data-jdbc/src/test/groovy/io/micronaut/data/jdbc/h2/H2EnumsMappingSpec.groovy

+2-2
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class H2EnumsMappingSpec extends Specification implements H2TestPropertyProvider
123123
def sql = builder.buildBatchCreateTableStatement(PersistentEntity.of(EnumEntity))
124124

125125
then:
126-
sql == 'CREATE TABLE `enum_entity` (`id` BIGINT AUTO_INCREMENT PRIMARY KEY,`as_default` VARCHAR(255) NOT NULL,`as_string` VARCHAR(255) NOT NULL,`as_int` INT NOT NULL);'
126+
sql == 'CREATE TABLE `enum_entity` (`id` BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,`as_default` VARCHAR(255) NOT NULL,`as_string` VARCHAR(255) NOT NULL,`as_int` INT NOT NULL);'
127127
}
128128

129129
void "test jpa create table with enums"() {
@@ -134,7 +134,7 @@ class H2EnumsMappingSpec extends Specification implements H2TestPropertyProvider
134134
def sql = builder.buildBatchCreateTableStatement(PersistentEntity.of(JpaEnumEntity))
135135

136136
then:
137-
sql == 'CREATE TABLE `jpa_enum_entity` (`id` BIGINT AUTO_INCREMENT PRIMARY KEY,`as_default` INT NOT NULL,`as_string` VARCHAR(255) NOT NULL,`as_int` INT NOT NULL);'
137+
sql == 'CREATE TABLE `jpa_enum_entity` (`id` BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,`as_default` INT NOT NULL,`as_string` VARCHAR(255) NOT NULL,`as_int` INT NOT NULL);'
138138
}
139139

140140
}

data-processor/src/test/groovy/io/micronaut/data/processor/sql/BuildTableSpec.groovy

+2-2
Original file line numberDiff line numberDiff line change
@@ -423,9 +423,9 @@ class Emb {
423423
def employeeGroupSql = builder.buildCreateTableStatements(employeeGroupEntity)
424424
then:"No join table is created"
425425
employeeSql.length == 1
426-
employeeSql[0] == 'CREATE TABLE `employee` (`id` BIGINT AUTO_INCREMENT PRIMARY KEY,`name` VARCHAR(255) NOT NULL,`category_id` BIGINT NOT NULL,`employer_id` BIGINT NOT NULL);'
426+
employeeSql[0] == 'CREATE TABLE `employee` (`id` BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,`name` VARCHAR(255) NOT NULL,`category_id` BIGINT NOT NULL,`employer_id` BIGINT NOT NULL);'
427427
employeeGroupSql.length == 1
428-
employeeGroupSql[0] == 'CREATE TABLE `employee_group` (`id` BIGINT AUTO_INCREMENT PRIMARY KEY,`name` VARCHAR(255) NOT NULL,`category_id` BIGINT NOT NULL,`employer_id` BIGINT NOT NULL);'
428+
employeeGroupSql[0] == 'CREATE TABLE `employee_group` (`id` BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,`name` VARCHAR(255) NOT NULL,`category_id` BIGINT NOT NULL,`employer_id` BIGINT NOT NULL);'
429429
}
430430

431431
void "test create ManyToMany table with schema"() {

0 commit comments

Comments
 (0)