Skip to content

Commit 2c30f14

Browse files
committed
Add DDL migration scripts to version 6.0
Resolves #4983
1 parent 0549eee commit 2c30f14

File tree

11 files changed

+26
-1
lines changed

11 files changed

+26
-1
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- IBM DB2 LUW (10.1+)
2+
RENAME SEQUENCE BATCH_JOB_SEQ TO BATCH_JOB_INSTANCE_SEQ;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
RENAME TABLE BATCH_JOB_SEQ TO BATCH_JOB_INSTANCE_SEQ;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
-- Sequence rename is not supported in H2
2+
-- https://github.com/h2database/h2database/issues/417
3+
4+
CREATE SEQUENCE BATCH_JOB_INSTANCE_SEQ;
5+
-- Copy last value from old sequence to new sequence
6+
DROP SEQUENCE BATCH_JOB_SEQ;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE BATCH_JOB_SEQ RENAME TO BATCH_JOB_INSTANCE_SEQ;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
RENAME SEQUENCE BATCH_JOB_SEQ TO BATCH_JOB_INSTANCE_SEQ;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-- MySQL: sequence emulated as a table
2+
RENAME TABLE BATCH_JOB_SEQ TO BATCH_JOB_INSTANCE_SEQ;
3+
4+
-- Alternative (MySQL): create new table, migrate value, drop old
5+
-- CREATE TABLE BATCH_JOB_INSTANCE_SEQ (ID BIGINT NOT NULL);
6+
-- INSERT INTO BATCH_JOB_INSTANCE_SEQ (ID) SELECT ID FROM BATCH_JOB_SEQ;
7+
-- DROP TABLE BATCH_JOB_SEQ;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
RENAME BATCH_JOB_SEQ to BATCH_JOB_INSTANCE_SEQ;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER SEQUENCE BATCH_JOB_SEQ RENAME TO BATCH_JOB_INSTANCE_SEQ;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE BATCH_JOB_SEQ RENAME TO BATCH_JOB_INSTANCE_SEQ;

spring-batch-core/src/main/resources/org/springframework/batch/core/migration/6.0/migration-sqlserver.sql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,7 @@ ALTER TABLE BATCH_STEP_EXECUTION_CONTEXT ALTER COLUMN SERIALIZED_CONTEXT NVARCHA
2828

2929
-- BATCH_JOB_EXECUTION_CONTEXT table
3030
ALTER TABLE BATCH_JOB_EXECUTION_CONTEXT ALTER COLUMN SHORT_CONTEXT NVARCHAR(2500) NOT NULL;
31-
ALTER TABLE BATCH_JOB_EXECUTION_CONTEXT ALTER COLUMN SERIALIZED_CONTEXT NVARCHAR(MAX) NULL;
31+
ALTER TABLE BATCH_JOB_EXECUTION_CONTEXT ALTER COLUMN SERIALIZED_CONTEXT NVARCHAR(MAX) NULL;
32+
33+
-- Rename sequence BATCH_JOB_SEQ to BATCH_JOB_INSTANCE_SEQ
34+
EXEC sp_rename 'BATCH_JOB_SEQ', 'BATCH_JOB_INSTANCE_SEQ';

0 commit comments

Comments
 (0)