Skip to content

Adjust test schema DDLs for compatibility with H2 2.x #29200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CREATE TABLE CITY (
id INTEGER IDENTITY PRIMARY KEY,
id INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
name VARCHAR(30),
state VARCHAR(30),
country VARCHAR(30),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -98,9 +98,11 @@ void healthIndicatorWhenDatabaseUpWithSuccessValidationQuery() {
CloseableConnectionFactory connectionFactory = createTestDatabase();
try {
String customValidationQuery = "SELECT COUNT(*) from HEALTH_TEST";
Mono.from(connectionFactory.create()).flatMapMany((it) -> Flux
.from(it.createStatement("CREATE TABLE HEALTH_TEST (id INTEGER IDENTITY PRIMARY KEY)").execute())
.flatMap(Result::getRowsUpdated).thenMany(it.close())).as(StepVerifier::create).verifyComplete();
String createTableStatement = "CREATE TABLE HEALTH_TEST (id INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY)";
Mono.from(connectionFactory.create())
.flatMapMany((it) -> Flux.from(it.createStatement(createTableStatement).execute())
.flatMap(Result::getRowsUpdated).thenMany(it.close()))
.as(StepVerifier::create).verifyComplete();
ReactiveHealthIndicator healthIndicator = new ConnectionFactoryHealthIndicator(connectionFactory,
customValidationQuery);
healthIndicator.health().as(StepVerifier::create).assertNext((actual) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ void testRenamePrefix() {
.withUserConfiguration(TestConfiguration.class, EmbeddedDataSourceConfiguration.class,
HibernateJpaAutoConfiguration.class)
.withPropertyValues("spring.datasource.generate-unique-name=true",
"spring.batch.jdbc.schema:classpath:batch/custom-schema-hsql.sql",
"spring.batch.jdbc.schema:classpath:batch/custom-schema.sql",
"spring.batch.jdbc.tablePrefix:PREFIX_")
.run((context) -> {
assertThat(context).hasSingleBean(JobLauncher.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -73,7 +73,7 @@ void jdbcWithDefaultSettings() {
void jdbcWithCustomPrefix() {
this.contextRunner.withUserConfiguration(DefaultConfiguration.class, EmbeddedDataSourceConfiguration.class)
.withPropertyValues("spring.datasource.generate-unique-name=true",
"spring.batch.jdbc.schema:classpath:batch/custom-schema-hsql.sql",
"spring.batch.jdbc.schema:classpath:batch/custom-schema.sql",
"spring.batch.jdbc.tablePrefix:PREFIX_")
.run((context) -> {
assertThat(new JdbcTemplate(context.getBean(DataSource.class))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
-- Autogenerated: do not edit this file

CREATE TABLE PREFIX_JOB_INSTANCE (
JOB_INSTANCE_ID BIGINT IDENTITY NOT NULL PRIMARY KEY ,
JOB_INSTANCE_ID BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY ,
VERSION BIGINT ,
JOB_NAME VARCHAR(100) NOT NULL,
JOB_KEY VARCHAR(32) NOT NULL,
constraint JOB_INST_UN unique (JOB_NAME, JOB_KEY)
) ;

CREATE TABLE PREFIX_JOB_EXECUTION (
JOB_EXECUTION_ID BIGINT IDENTITY NOT NULL PRIMARY KEY ,
JOB_EXECUTION_ID BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY ,
VERSION BIGINT ,
JOB_INSTANCE_ID BIGINT NOT NULL,
CREATE_TIME TIMESTAMP NOT NULL,
Expand Down Expand Up @@ -38,7 +38,7 @@ CREATE TABLE PREFIX_JOB_EXECUTION_PARAMS (
) ;

CREATE TABLE PREFIX_STEP_EXECUTION (
STEP_EXECUTION_ID BIGINT IDENTITY NOT NULL PRIMARY KEY ,
STEP_EXECUTION_ID BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY ,
VERSION BIGINT NOT NULL,
STEP_NAME VARCHAR(100) NOT NULL,
JOB_EXECUTION_ID BIGINT NOT NULL,
Expand Down Expand Up @@ -77,11 +77,11 @@ CREATE TABLE PREFIX_JOB_EXECUTION_CONTEXT (
) ;

CREATE TABLE PREFIX_STEP_EXECUTION_SEQ (
ID BIGINT IDENTITY
ID BIGINT GENERATED BY DEFAULT AS IDENTITY
);
CREATE TABLE PREFIX_JOB_EXECUTION_SEQ (
ID BIGINT IDENTITY
ID BIGINT GENERATED BY DEFAULT AS IDENTITY
);
CREATE TABLE PREFIX_JOB_SEQ (
ID BIGINT IDENTITY
ID BIGINT GENERATED BY DEFAULT AS IDENTITY
);
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CREATE TABLE CITY (
id INTEGER IDENTITY PRIMARY KEY,
id INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
name VARCHAR(30),
state VARCHAR(30),
country VARCHAR(30),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TABLE SPAM (
id INTEGER IDENTITY PRIMARY KEY,
id INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
name VARCHAR(30)
);
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TABLE FOO (
id INTEGER IDENTITY PRIMARY KEY,
id INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
todrop VARCHAR(30)
);
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TABLE FOO (
id INTEGER IDENTITY PRIMARY KEY,
id INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
name VARCHAR(30)
);
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TABLE BAR (
id INTEGER IDENTITY PRIMARY KEY,
id INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
name VARCHAR(30)
);
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TABLE FOO (
id INTEGER IDENTITY PRIMARY KEY,
id INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
name VARCHAR(30)
);
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TABLE EXAMPLE (
id INTEGER IDENTITY PRIMARY KEY,
id INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
name VARCHAR(30)
);
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CREATE TABLE CUSTOMER (
ID INTEGER IDENTITY PRIMARY KEY,
ID INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
FIRST_NAME VARCHAR(30),
DATE_OF_BIRTH DATE
);
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CREATE TABLE CITY (
id INTEGER IDENTITY PRIMARY KEY,
id INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
name VARCHAR(30),
state VARCHAR(30),
country VARCHAR(30)
Expand Down