Skip to content

Add migration script integration tests #4954

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

baezzys
Copy link
Contributor

@baezzys baezzys commented Aug 18, 2025

Overview

This PR adds integration tests to validate the Spring Batch 4.x → 5.0 database schema migration scripts for all datasources where 5.0 migration scripts are available.

Resolves #4289

Implementation Details

Test Strategy

The tests implement the following validation approach:

  1. Create 4.x baseline schema using newly created schema-{database}-4.sql files
  2. Apply 5.0 migration scripts from existing migration/5.0/migration-{database}.sql files
  3. Verify successful execution without SQL errors

Database Coverage

Working Databases (Tests Pass)

  • PostgreSQL - TestContainers based, fully functional
  • MySQL - TestContainers based, fully functional
  • Oracle - TestContainers based, fully functional
  • SQL Server - TestContainers based, fully functional
  • H2 - Embedded database, fully functional

Migration Issues Discovered (Tests Fail)

During testing, migration script execution failed on several databases due to compatibility issues:

Database Issue Error Message Root Cause
Derby MODIFY COLUMN syntax not supported Syntax error: Encountered "MODIFY" Derby uses different ALTER syntax
SQLite MODIFY COLUMN syntax not supported near "MODIFY": syntax error SQLite has limited ALTER support
HSQLDB MODIFY COLUMN syntax not supported unexpected token: MODIFY HSQLDB uses different column modification syntax
DB2 MODIFY COLUMN syntax not supported SQLCODE=-104, SQLSTATE=42601 DB2 uses different ALTER syntax
Sybase Database configuration required ALTER TABLE with data copy cannot be done Requires select into and full logging options

Technical Implementation

TestContainers Integration:

  • Auto-disabled when Docker unavailable using @Testcontainers(disabledWithoutDocker = true)
  • Comprehensive database coverage with official images

Embedded Database Support:

  • Leverages Spring's EmbeddedDatabaseBuilder for consistency

@baezzys baezzys force-pushed the feature/add-migration-script-integration-tests branch from 1f11625 to ced1cbf Compare August 18, 2025 10:18
@baezzys baezzys changed the title GH-4289: Add schema migration integration tests GH-4289: Add migration script integration tests Aug 18, 2025
@baezzys baezzys force-pushed the feature/add-migration-script-integration-tests branch from 91bb4d2 to 8608e18 Compare August 18, 2025 14:56
@baezzys baezzys changed the title GH-4289: Add migration script integration tests Add migration script integration tests Aug 18, 2025
@baezzys baezzys force-pushed the feature/add-migration-script-integration-tests branch 2 times, most recently from b095f10 to b2c63d3 Compare August 19, 2025 01:18
- Implement 4.x to 5.0 migration validation for all supported databases
- Add 4.x baseline schema files for migration testing
- Use TestContainers for major databases, embedded for others
- Auto-disable tests when Docker unavailable

Resolves: spring-projects#4289
Signed-off-by: baezzys <[email protected]>
@baezzys baezzys force-pushed the feature/add-migration-script-integration-tests branch from aa77031 to d79971b Compare August 21, 2025 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add integration tests for DDL migration scripts
1 participant