-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Incorrect v5 migration script for SQLServer #4349
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
Comments
Thank you for raising this. This is similar to another issue we had with PostgreSQL and Oracle. The SQL syntax is not the same for each database, which was assumed when creating the migration scripts.. I created an issue to improve the testing process for next releases, see #4289. I will plan the fix for the next release. You are welcome to contribute if you managed to correctly migrate your schema to v5 on SQLServer. |
The renaming of columns was updated to use The script was verified with the following test, which I keep here for a later reference: package org.springframework.batch.core.test.repository;
import com.microsoft.sqlserver.jdbc.SQLServerDataSource;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.testcontainers.containers.MSSQLServerContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.utility.DockerImageName;
import org.springframework.core.io.ClassPathResource;
import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
/**
* @author Mahmoud Ben Hassine
*/
@Testcontainers
class SQLServerMigrationScriptIntegrationTests {
private static final DockerImageName SQLSERVER_IMAGE = DockerImageName
.parse("mcr.microsoft.com/mssql/server:2019-CU20-ubuntu-20.04");
@Container
public static MSSQLServerContainer<?> sqlserver = new MSSQLServerContainer<>(SQLSERVER_IMAGE).acceptLicense();
@Test
void migrationScriptShouldBeValid() {
SQLServerDataSource dataSource = new SQLServerDataSource();
dataSource.setUser(sqlserver.getUsername());
dataSource.setPassword(sqlserver.getPassword());
dataSource.setURL(sqlserver.getJdbcUrl());
ResourceDatabasePopulator databasePopulator = new ResourceDatabasePopulator();
databasePopulator.addScript(new ClassPathResource("/org/springframework/batch/core/schema-sqlserver-v4.sql"));
databasePopulator.addScript(new ClassPathResource("/org/springframework/batch/core/migration/5.0/migration-sqlserver.sql"));
Assertions.assertDoesNotThrow(() -> databasePopulator.execute(dataSource));
}
} |
Bug description
The migration script for sqlserver provided in spring-batch-core for version 5.0 is incorrect.
Environment
Spring Batch version: 5.0.1, Java version = 17.0.6_10, database=SQLServer 2019
Steps to reproduce
All bugs relate to the table BATCH_JOB_EXECUTION_PARAMS in migration-sqlserver.sql script under 5.0:
The text was updated successfully, but these errors were encountered: