Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #148 from willschipp/BATCH-1977

* BATCH-1977:
  BATCH-1977: Rearranged scripts and fixed comment issue
  BATCH-1977 - migration scripts included create tables
  BATCH-1977 updated insert statement to copy all the job executions for all the instances and their parameters
  BATCH-1977 - script to migrate batch_job_params to new batch_job_execution_params
  • Loading branch information...
commit 5d88e038012d31c3691f2cead4370c2fb8bf298e 2 parents 74efeb0 + f3bb44d
Michael Minella authored March 22, 2013
28  spring-batch-core/src/main/resources/org/springframework/batch/core/2.1-to-2.2-migration/migration-h2.sql
... ...
@@ -0,0 +1,28 @@
  1
+
  2
+-- create the requisite table
  3
+
  4
+CREATE TABLE BATCH_JOB_EXECUTION_PARAMS  (
  5
+	JOB_EXECUTION_ID BIGINT NOT NULL ,
  6
+	TYPE_CD VARCHAR(6) NOT NULL ,
  7
+	KEY_NAME VARCHAR(100) NOT NULL ,
  8
+	STRING_VAL VARCHAR(250) ,
  9
+	DATE_VAL TIMESTAMP DEFAULT NULL ,
  10
+	LONG_VAL BIGINT ,
  11
+	DOUBLE_VAL DOUBLE PRECISION ,
  12
+	IDENTIFYING CHAR(1) NOT NULL ,
  13
+	constraint JOB_EXEC_PARAMS_FK foreign key (JOB_EXECUTION_ID)
  14
+	references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID)
  15
+) ;
  16
+
  17
+-- insert script that 'copies' existing batch_job_params to batch_job_execution_params
  18
+-- sets new params to identifying ones
  19
+-- verified on h2, 
  20
+
  21
+INSERT INTO BATCH_JOB_EXECUTION_PARAMS 
  22
+	( JOB_EXECUTION_ID , TYPE_CD, KEY_NAME, STRING_VAL, DATE_VAL, LONG_VAL, DOUBLE_VAL, IDENTIFYING )
  23
+SELECT 
  24
+	JE.JOB_EXECUTION_ID , JP.TYPE_CD , JP.KEY_NAME , JP.STRING_VAL , JP.DATE_VAL , JP.LONG_VAL , JP.DOUBLE_VAL , 1 
  25
+FROM 
  26
+	BATCH_JOB_PARAMS JP,BATCH_JOB_EXECUTION JE
  27
+WHERE 
  28
+	JP.JOB_INSTANCE_ID = JE.JOB_INSTANCE_ID;
28  ...g-batch-core/src/main/resources/org/springframework/batch/core/2.1-to-2.2-migration/migration-hsqldb.sql
... ...
@@ -0,0 +1,28 @@
  1
+
  2
+-- create the requisite table
  3
+
  4
+CREATE TABLE BATCH_JOB_EXECUTION_PARAMS  (
  5
+	JOB_EXECUTION_ID BIGINT NOT NULL ,
  6
+	TYPE_CD VARCHAR(6) NOT NULL ,
  7
+	KEY_NAME VARCHAR(100) NOT NULL ,
  8
+	STRING_VAL VARCHAR(250) ,
  9
+	DATE_VAL TIMESTAMP DEFAULT NULL ,
  10
+	LONG_VAL BIGINT ,
  11
+	DOUBLE_VAL DOUBLE PRECISION ,
  12
+	IDENTIFYING CHAR(1) NOT NULL ,
  13
+	constraint JOB_EXEC_PARAMS_FK foreign key (JOB_EXECUTION_ID)
  14
+	references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID)
  15
+) ;
  16
+
  17
+-- insert script that 'copies' existing batch_job_params to batch_job_execution_params
  18
+-- sets new params to identifying ones
  19
+-- verified on h2, 
  20
+
  21
+INSERT INTO BATCH_JOB_EXECUTION_PARAMS 
  22
+	( JOB_EXECUTION_ID , TYPE_CD, KEY_NAME, STRING_VAL, DATE_VAL, LONG_VAL, DOUBLE_VAL, IDENTIFYING )
  23
+SELECT 
  24
+	JE.JOB_EXECUTION_ID , JP.TYPE_CD , JP.KEY_NAME , JP.STRING_VAL , JP.DATE_VAL , JP.LONG_VAL , JP.DOUBLE_VAL , 1 
  25
+FROM 
  26
+	BATCH_JOB_PARAMS JP,BATCH_JOB_EXECUTION JE
  27
+WHERE 
  28
+	JP.JOB_INSTANCE_ID = JE.JOB_INSTANCE_ID;
13  ...ch-core/src/main/resources/org/springframework/batch/core/2.1-to-2.2-migration/migration-insert-only.sql
... ...
@@ -0,0 +1,13 @@
  1
+
  2
+-- insert script that 'copies' existing batch_job_params to batch_job_execution_params
  3
+-- sets new params to identifying ones
  4
+-- verified on h2, 
  5
+
  6
+INSERT INTO BATCH_JOB_EXECUTION_PARAMS 
  7
+	( JOB_EXECUTION_ID , TYPE_CD, KEY_NAME, STRING_VAL, DATE_VAL, LONG_VAL, DOUBLE_VAL, IDENTIFYING )
  8
+SELECT 
  9
+	JE.JOB_EXECUTION_ID , JP.TYPE_CD , JP.KEY_NAME , JP.STRING_VAL , JP.DATE_VAL , JP.LONG_VAL , JP.DOUBLE_VAL , 1 
  10
+FROM 
  11
+	BATCH_JOB_PARAMS JP,BATCH_JOB_EXECUTION JE
  12
+WHERE 
  13
+	JP.JOB_INSTANCE_ID = JE.JOB_INSTANCE_ID;
28  ...ng-batch-core/src/main/resources/org/springframework/batch/core/2.1-to-2.2-migration/migration-mysql.sql
... ...
@@ -0,0 +1,28 @@
  1
+
  2
+-- create the requisite table
  3
+
  4
+CREATE TABLE BATCH_JOB_EXECUTION_PARAMS  (
  5
+	JOB_EXECUTION_ID BIGINT NOT NULL ,
  6
+	TYPE_CD VARCHAR(6) NOT NULL ,
  7
+	KEY_NAME VARCHAR(100) NOT NULL ,
  8
+	STRING_VAL VARCHAR(250) ,
  9
+	DATE_VAL DATETIME DEFAULT NULL ,
  10
+	LONG_VAL BIGINT ,
  11
+	DOUBLE_VAL DOUBLE PRECISION ,
  12
+	IDENTIFYING CHAR(1) NOT NULL ,
  13
+	constraint JOB_EXEC_PARAMS_FK foreign key (JOB_EXECUTION_ID)
  14
+	references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID)
  15
+) ENGINE=InnoDB;
  16
+
  17
+-- insert script that 'copies' existing batch_job_params to batch_job_execution_params
  18
+-- sets new params to identifying ones
  19
+-- verified on h2, 
  20
+
  21
+INSERT INTO BATCH_JOB_EXECUTION_PARAMS 
  22
+	( JOB_EXECUTION_ID , TYPE_CD, KEY_NAME, STRING_VAL, DATE_VAL, LONG_VAL, DOUBLE_VAL, IDENTIFYING )
  23
+SELECT 
  24
+	JE.JOB_EXECUTION_ID , JP.TYPE_CD , JP.KEY_NAME , JP.STRING_VAL , JP.DATE_VAL , JP.LONG_VAL , JP.DOUBLE_VAL , 1 
  25
+FROM 
  26
+	BATCH_JOB_PARAMS JP,BATCH_JOB_EXECUTION JE
  27
+WHERE 
  28
+	JP.JOB_INSTANCE_ID = JE.JOB_INSTANCE_ID;
28  ...atch-core/src/main/resources/org/springframework/batch/core/2.1-to-2.2-migration/migration-oracle10g.sql
... ...
@@ -0,0 +1,28 @@
  1
+
  2
+-- create the requisite table
  3
+
  4
+CREATE TABLE BATCH_JOB_EXECUTION_PARAMS  (
  5
+	JOB_EXECUTION_ID NUMBER(19,0) NOT NULL ,
  6
+	TYPE_CD VARCHAR2(6) NOT NULL ,
  7
+	KEY_NAME VARCHAR2(100) NOT NULL ,
  8
+	STRING_VAL VARCHAR2(250) ,
  9
+	DATE_VAL TIMESTAMP DEFAULT NULL ,
  10
+	LONG_VAL NUMBER(19,0) ,
  11
+	DOUBLE_VAL NUMBER ,
  12
+	IDENTIFYING CHAR(1) NOT NULL ,
  13
+	constraint JOB_EXEC_PARAMS_FK foreign key (JOB_EXECUTION_ID)
  14
+	references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID)
  15
+) ;
  16
+
  17
+-- insert script that 'copies' existing batch_job_params to batch_job_execution_params
  18
+-- sets new params to identifying ones
  19
+-- verified on h2, 
  20
+
  21
+INSERT INTO BATCH_JOB_EXECUTION_PARAMS 
  22
+	( JOB_EXECUTION_ID , TYPE_CD, KEY_NAME, STRING_VAL, DATE_VAL, LONG_VAL, DOUBLE_VAL, IDENTIFYING )
  23
+SELECT 
  24
+	JE.JOB_EXECUTION_ID , JP.TYPE_CD , JP.KEY_NAME , JP.STRING_VAL , JP.DATE_VAL , JP.LONG_VAL , JP.DOUBLE_VAL , 1 
  25
+FROM 
  26
+	BATCH_JOB_PARAMS JP,BATCH_JOB_EXECUTION JE
  27
+WHERE 
  28
+	JP.JOB_INSTANCE_ID = JE.JOB_INSTANCE_ID;
28  ...tch-core/src/main/resources/org/springframework/batch/core/2.1-to-2.2-migration/migration-postgresql.sql
... ...
@@ -0,0 +1,28 @@
  1
+
  2
+-- create the requisite table
  3
+
  4
+CREATE TABLE BATCH_JOB_EXECUTION_PARAMS  (
  5
+	JOB_EXECUTION_ID BIGINT NOT NULL ,
  6
+	TYPE_CD VARCHAR(6) NOT NULL ,
  7
+	KEY_NAME VARCHAR(100) NOT NULL ,
  8
+	STRING_VAL VARCHAR(250) ,
  9
+	DATE_VAL TIMESTAMP DEFAULT NULL ,
  10
+	LONG_VAL BIGINT ,
  11
+	DOUBLE_VAL DOUBLE PRECISION ,
  12
+	IDENTIFYING CHAR(1) NOT NULL ,
  13
+	constraint JOB_EXEC_PARAMS_FK foreign key (JOB_EXECUTION_ID)
  14
+	references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID)
  15
+) ;
  16
+
  17
+-- insert script that 'copies' existing batch_job_params to batch_job_execution_params
  18
+-- sets new params to identifying ones
  19
+-- verified on h2, 
  20
+
  21
+INSERT INTO BATCH_JOB_EXECUTION_PARAMS 
  22
+	( JOB_EXECUTION_ID , TYPE_CD, KEY_NAME, STRING_VAL, DATE_VAL, LONG_VAL, DOUBLE_VAL, IDENTIFYING )
  23
+SELECT 
  24
+	JE.JOB_EXECUTION_ID , JP.TYPE_CD , JP.KEY_NAME , JP.STRING_VAL , JP.DATE_VAL , JP.LONG_VAL , JP.DOUBLE_VAL , 1 
  25
+FROM 
  26
+	BATCH_JOB_PARAMS JP,BATCH_JOB_EXECUTION JE
  27
+WHERE 
  28
+	JP.JOB_INSTANCE_ID = JE.JOB_INSTANCE_ID;
28  spring-batch-core/src/main/resources/org/springframework/batch/core/2.1-to-2.2-migration/migration-sqlf.sql
... ...
@@ -0,0 +1,28 @@
  1
+
  2
+-- create the requisite table
  3
+
  4
+CREATE TABLE BATCH_JOB_EXECUTION_PARAMS  (
  5
+	JOB_EXECUTION_ID BIGINT NOT NULL ,
  6
+	TYPE_CD VARCHAR(6) NOT NULL ,
  7
+	KEY_NAME VARCHAR(100) NOT NULL ,
  8
+	STRING_VAL VARCHAR(250) ,
  9
+	DATE_VAL TIMESTAMP DEFAULT NULL ,
  10
+	LONG_VAL BIGINT ,
  11
+	DOUBLE_VAL DOUBLE PRECISION ,
  12
+	IDENTIFYING CHAR(1) NOT NULL ,
  13
+	constraint JOB_EXEC_PARAMS_FK foreign key (JOB_EXECUTION_ID)
  14
+	references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID)
  15
+) ;
  16
+
  17
+-- insert script that 'copies' existing batch_job_params to batch_job_execution_params
  18
+-- sets new params to identifying ones
  19
+-- verified on h2, 
  20
+
  21
+INSERT INTO BATCH_JOB_EXECUTION_PARAMS 
  22
+	( JOB_EXECUTION_ID , TYPE_CD, KEY_NAME, STRING_VAL, DATE_VAL, LONG_VAL, DOUBLE_VAL, IDENTIFYING )
  23
+SELECT 
  24
+	JE.JOB_EXECUTION_ID , JP.TYPE_CD , JP.KEY_NAME , JP.STRING_VAL , JP.DATE_VAL , JP.LONG_VAL , JP.DOUBLE_VAL , 1 
  25
+FROM 
  26
+	BATCH_JOB_PARAMS JP,BATCH_JOB_EXECUTION JE
  27
+WHERE 
  28
+	JP.JOB_INSTANCE_ID = JE.JOB_INSTANCE_ID;
28  ...atch-core/src/main/resources/org/springframework/batch/core/2.1-to-2.2-migration/migration-sqlserver.sql
... ...
@@ -0,0 +1,28 @@
  1
+
  2
+-- create the requisite table
  3
+
  4
+CREATE TABLE BATCH_JOB_EXECUTION_PARAMS  (
  5
+	JOB_EXECUTION_ID BIGINT NOT NULL ,
  6
+	TYPE_CD VARCHAR(6) NOT NULL ,
  7
+	KEY_NAME VARCHAR(100) NOT NULL ,
  8
+	STRING_VAL VARCHAR(250) ,
  9
+	DATE_VAL DATETIME DEFAULT NULL ,
  10
+	LONG_VAL BIGINT ,
  11
+	DOUBLE_VAL DOUBLE PRECISION ,
  12
+	IDENTIFYING CHAR(1) NOT NULL ,
  13
+	constraint JOB_EXEC_PARAMS_FK foreign key (JOB_EXECUTION_ID)
  14
+	references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID)
  15
+) ;
  16
+
  17
+-- insert script that 'copies' existing batch_job_params to batch_job_execution_params
  18
+-- sets new params to identifying ones
  19
+-- verified on h2, 
  20
+
  21
+INSERT INTO BATCH_JOB_EXECUTION_PARAMS 
  22
+	( JOB_EXECUTION_ID , TYPE_CD, KEY_NAME, STRING_VAL, DATE_VAL, LONG_VAL, DOUBLE_VAL, IDENTIFYING )
  23
+SELECT 
  24
+	JE.JOB_EXECUTION_ID , JP.TYPE_CD , JP.KEY_NAME , JP.STRING_VAL , JP.DATE_VAL , JP.LONG_VAL , JP.DOUBLE_VAL , 1 
  25
+FROM 
  26
+	BATCH_JOB_PARAMS JP,BATCH_JOB_EXECUTION JE
  27
+WHERE 
  28
+	JP.JOB_INSTANCE_ID = JE.JOB_INSTANCE_ID;
28  ...g-batch-core/src/main/resources/org/springframework/batch/core/2.1-to-2.2-migration/migration-sybase.sql
... ...
@@ -0,0 +1,28 @@
  1
+
  2
+-- create the requisite table
  3
+
  4
+CREATE TABLE BATCH_JOB_EXECUTION_PARAMS  (
  5
+	JOB_EXECUTION_ID BIGINT NOT NULL ,
  6
+	TYPE_CD VARCHAR(6) NOT NULL ,
  7
+	KEY_NAME VARCHAR(100) NOT NULL ,
  8
+	STRING_VAL VARCHAR(250) NULL,
  9
+	DATE_VAL DATETIME DEFAULT NULL NULL,
  10
+	LONG_VAL BIGINT NULL,
  11
+	DOUBLE_VAL DOUBLE PRECISION NULL,
  12
+	IDENTIFYING CHAR(1) NOT NULL ,
  13
+	constraint JOB_EXEC_PARAMS_FK foreign key (JOB_EXECUTION_ID)
  14
+	references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID)
  15
+) ;
  16
+
  17
+-- insert script that 'copies' existing batch_job_params to batch_job_execution_params
  18
+-- sets new params to identifying ones
  19
+-- verified on h2, 
  20
+
  21
+INSERT INTO BATCH_JOB_EXECUTION_PARAMS 
  22
+	( JOB_EXECUTION_ID , TYPE_CD, KEY_NAME, STRING_VAL, DATE_VAL, LONG_VAL, DOUBLE_VAL, IDENTIFYING )
  23
+SELECT 
  24
+	JE.JOB_EXECUTION_ID , JP.TYPE_CD , JP.KEY_NAME , JP.STRING_VAL , JP.DATE_VAL , JP.LONG_VAL , JP.DOUBLE_VAL , 1 
  25
+FROM 
  26
+	BATCH_JOB_PARAMS JP,BATCH_JOB_EXECUTION JE
  27
+WHERE 
  28
+	JP.JOB_INSTANCE_ID = JE.JOB_INSTANCE_ID;

0 notes on commit 5d88e03

Please sign in to comment.
Something went wrong with that request. Please try again.