Permalink
Browse files

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...
2 parents 74efeb0 + f3bb44d commit 5d88e038012d31c3691f2cead4370c2fb8bf298e @mminella mminella committed Mar 22, 2013
View
28 ...e/src/main/resources/org/springframework/batch/core/2.1-to-2.2-migration/migration-h2.sql
@@ -0,0 +1,28 @@
+
+-- create the requisite table
+
+CREATE TABLE BATCH_JOB_EXECUTION_PARAMS (
+ JOB_EXECUTION_ID BIGINT NOT NULL ,
+ TYPE_CD VARCHAR(6) NOT NULL ,
+ KEY_NAME VARCHAR(100) NOT NULL ,
+ STRING_VAL VARCHAR(250) ,
+ DATE_VAL TIMESTAMP DEFAULT NULL ,
+ LONG_VAL BIGINT ,
+ DOUBLE_VAL DOUBLE PRECISION ,
+ IDENTIFYING CHAR(1) NOT NULL ,
+ constraint JOB_EXEC_PARAMS_FK foreign key (JOB_EXECUTION_ID)
+ references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID)
+) ;
+
+-- insert script that 'copies' existing batch_job_params to batch_job_execution_params
+-- sets new params to identifying ones
+-- verified on h2,
+
+INSERT INTO BATCH_JOB_EXECUTION_PARAMS
+ ( JOB_EXECUTION_ID , TYPE_CD, KEY_NAME, STRING_VAL, DATE_VAL, LONG_VAL, DOUBLE_VAL, IDENTIFYING )
+SELECT
+ JE.JOB_EXECUTION_ID , JP.TYPE_CD , JP.KEY_NAME , JP.STRING_VAL , JP.DATE_VAL , JP.LONG_VAL , JP.DOUBLE_VAL , 1
+FROM
+ BATCH_JOB_PARAMS JP,BATCH_JOB_EXECUTION JE
+WHERE
+ JP.JOB_INSTANCE_ID = JE.JOB_INSTANCE_ID;
View
28 ...c/main/resources/org/springframework/batch/core/2.1-to-2.2-migration/migration-hsqldb.sql
@@ -0,0 +1,28 @@
+
+-- create the requisite table
+
+CREATE TABLE BATCH_JOB_EXECUTION_PARAMS (
+ JOB_EXECUTION_ID BIGINT NOT NULL ,
+ TYPE_CD VARCHAR(6) NOT NULL ,
+ KEY_NAME VARCHAR(100) NOT NULL ,
+ STRING_VAL VARCHAR(250) ,
+ DATE_VAL TIMESTAMP DEFAULT NULL ,
+ LONG_VAL BIGINT ,
+ DOUBLE_VAL DOUBLE PRECISION ,
+ IDENTIFYING CHAR(1) NOT NULL ,
+ constraint JOB_EXEC_PARAMS_FK foreign key (JOB_EXECUTION_ID)
+ references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID)
+) ;
+
+-- insert script that 'copies' existing batch_job_params to batch_job_execution_params
+-- sets new params to identifying ones
+-- verified on h2,
+
+INSERT INTO BATCH_JOB_EXECUTION_PARAMS
+ ( JOB_EXECUTION_ID , TYPE_CD, KEY_NAME, STRING_VAL, DATE_VAL, LONG_VAL, DOUBLE_VAL, IDENTIFYING )
+SELECT
+ JE.JOB_EXECUTION_ID , JP.TYPE_CD , JP.KEY_NAME , JP.STRING_VAL , JP.DATE_VAL , JP.LONG_VAL , JP.DOUBLE_VAL , 1
+FROM
+ BATCH_JOB_PARAMS JP,BATCH_JOB_EXECUTION JE
+WHERE
+ JP.JOB_INSTANCE_ID = JE.JOB_INSTANCE_ID;
View
13 ...n/resources/org/springframework/batch/core/2.1-to-2.2-migration/migration-insert-only.sql
@@ -0,0 +1,13 @@
+
+-- insert script that 'copies' existing batch_job_params to batch_job_execution_params
+-- sets new params to identifying ones
+-- verified on h2,
+
+INSERT INTO BATCH_JOB_EXECUTION_PARAMS
+ ( JOB_EXECUTION_ID , TYPE_CD, KEY_NAME, STRING_VAL, DATE_VAL, LONG_VAL, DOUBLE_VAL, IDENTIFYING )
+SELECT
+ JE.JOB_EXECUTION_ID , JP.TYPE_CD , JP.KEY_NAME , JP.STRING_VAL , JP.DATE_VAL , JP.LONG_VAL , JP.DOUBLE_VAL , 1
+FROM
+ BATCH_JOB_PARAMS JP,BATCH_JOB_EXECUTION JE
+WHERE
+ JP.JOB_INSTANCE_ID = JE.JOB_INSTANCE_ID;
View
28 ...rc/main/resources/org/springframework/batch/core/2.1-to-2.2-migration/migration-mysql.sql
@@ -0,0 +1,28 @@
+
+-- create the requisite table
+
+CREATE TABLE BATCH_JOB_EXECUTION_PARAMS (
+ JOB_EXECUTION_ID BIGINT NOT NULL ,
+ TYPE_CD VARCHAR(6) NOT NULL ,
+ KEY_NAME VARCHAR(100) NOT NULL ,
+ STRING_VAL VARCHAR(250) ,
+ DATE_VAL DATETIME DEFAULT NULL ,
+ LONG_VAL BIGINT ,
+ DOUBLE_VAL DOUBLE PRECISION ,
+ IDENTIFYING CHAR(1) NOT NULL ,
+ constraint JOB_EXEC_PARAMS_FK foreign key (JOB_EXECUTION_ID)
+ references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID)
+) ENGINE=InnoDB;
+
+-- insert script that 'copies' existing batch_job_params to batch_job_execution_params
+-- sets new params to identifying ones
+-- verified on h2,
+
+INSERT INTO BATCH_JOB_EXECUTION_PARAMS
+ ( JOB_EXECUTION_ID , TYPE_CD, KEY_NAME, STRING_VAL, DATE_VAL, LONG_VAL, DOUBLE_VAL, IDENTIFYING )
+SELECT
+ JE.JOB_EXECUTION_ID , JP.TYPE_CD , JP.KEY_NAME , JP.STRING_VAL , JP.DATE_VAL , JP.LONG_VAL , JP.DOUBLE_VAL , 1
+FROM
+ BATCH_JOB_PARAMS JP,BATCH_JOB_EXECUTION JE
+WHERE
+ JP.JOB_INSTANCE_ID = JE.JOB_INSTANCE_ID;
View
28 ...ain/resources/org/springframework/batch/core/2.1-to-2.2-migration/migration-oracle10g.sql
@@ -0,0 +1,28 @@
+
+-- create the requisite table
+
+CREATE TABLE BATCH_JOB_EXECUTION_PARAMS (
+ JOB_EXECUTION_ID NUMBER(19,0) NOT NULL ,
+ TYPE_CD VARCHAR2(6) NOT NULL ,
+ KEY_NAME VARCHAR2(100) NOT NULL ,
+ STRING_VAL VARCHAR2(250) ,
+ DATE_VAL TIMESTAMP DEFAULT NULL ,
+ LONG_VAL NUMBER(19,0) ,
+ DOUBLE_VAL NUMBER ,
+ IDENTIFYING CHAR(1) NOT NULL ,
+ constraint JOB_EXEC_PARAMS_FK foreign key (JOB_EXECUTION_ID)
+ references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID)
+) ;
+
+-- insert script that 'copies' existing batch_job_params to batch_job_execution_params
+-- sets new params to identifying ones
+-- verified on h2,
+
+INSERT INTO BATCH_JOB_EXECUTION_PARAMS
+ ( JOB_EXECUTION_ID , TYPE_CD, KEY_NAME, STRING_VAL, DATE_VAL, LONG_VAL, DOUBLE_VAL, IDENTIFYING )
+SELECT
+ JE.JOB_EXECUTION_ID , JP.TYPE_CD , JP.KEY_NAME , JP.STRING_VAL , JP.DATE_VAL , JP.LONG_VAL , JP.DOUBLE_VAL , 1
+FROM
+ BATCH_JOB_PARAMS JP,BATCH_JOB_EXECUTION JE
+WHERE
+ JP.JOB_INSTANCE_ID = JE.JOB_INSTANCE_ID;
View
28 ...in/resources/org/springframework/batch/core/2.1-to-2.2-migration/migration-postgresql.sql
@@ -0,0 +1,28 @@
+
+-- create the requisite table
+
+CREATE TABLE BATCH_JOB_EXECUTION_PARAMS (
+ JOB_EXECUTION_ID BIGINT NOT NULL ,
+ TYPE_CD VARCHAR(6) NOT NULL ,
+ KEY_NAME VARCHAR(100) NOT NULL ,
+ STRING_VAL VARCHAR(250) ,
+ DATE_VAL TIMESTAMP DEFAULT NULL ,
+ LONG_VAL BIGINT ,
+ DOUBLE_VAL DOUBLE PRECISION ,
+ IDENTIFYING CHAR(1) NOT NULL ,
+ constraint JOB_EXEC_PARAMS_FK foreign key (JOB_EXECUTION_ID)
+ references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID)
+) ;
+
+-- insert script that 'copies' existing batch_job_params to batch_job_execution_params
+-- sets new params to identifying ones
+-- verified on h2,
+
+INSERT INTO BATCH_JOB_EXECUTION_PARAMS
+ ( JOB_EXECUTION_ID , TYPE_CD, KEY_NAME, STRING_VAL, DATE_VAL, LONG_VAL, DOUBLE_VAL, IDENTIFYING )
+SELECT
+ JE.JOB_EXECUTION_ID , JP.TYPE_CD , JP.KEY_NAME , JP.STRING_VAL , JP.DATE_VAL , JP.LONG_VAL , JP.DOUBLE_VAL , 1
+FROM
+ BATCH_JOB_PARAMS JP,BATCH_JOB_EXECUTION JE
+WHERE
+ JP.JOB_INSTANCE_ID = JE.JOB_INSTANCE_ID;
View
28 ...src/main/resources/org/springframework/batch/core/2.1-to-2.2-migration/migration-sqlf.sql
@@ -0,0 +1,28 @@
+
+-- create the requisite table
+
+CREATE TABLE BATCH_JOB_EXECUTION_PARAMS (
+ JOB_EXECUTION_ID BIGINT NOT NULL ,
+ TYPE_CD VARCHAR(6) NOT NULL ,
+ KEY_NAME VARCHAR(100) NOT NULL ,
+ STRING_VAL VARCHAR(250) ,
+ DATE_VAL TIMESTAMP DEFAULT NULL ,
+ LONG_VAL BIGINT ,
+ DOUBLE_VAL DOUBLE PRECISION ,
+ IDENTIFYING CHAR(1) NOT NULL ,
+ constraint JOB_EXEC_PARAMS_FK foreign key (JOB_EXECUTION_ID)
+ references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID)
+) ;
+
+-- insert script that 'copies' existing batch_job_params to batch_job_execution_params
+-- sets new params to identifying ones
+-- verified on h2,
+
+INSERT INTO BATCH_JOB_EXECUTION_PARAMS
+ ( JOB_EXECUTION_ID , TYPE_CD, KEY_NAME, STRING_VAL, DATE_VAL, LONG_VAL, DOUBLE_VAL, IDENTIFYING )
+SELECT
+ JE.JOB_EXECUTION_ID , JP.TYPE_CD , JP.KEY_NAME , JP.STRING_VAL , JP.DATE_VAL , JP.LONG_VAL , JP.DOUBLE_VAL , 1
+FROM
+ BATCH_JOB_PARAMS JP,BATCH_JOB_EXECUTION JE
+WHERE
+ JP.JOB_INSTANCE_ID = JE.JOB_INSTANCE_ID;
View
28 ...ain/resources/org/springframework/batch/core/2.1-to-2.2-migration/migration-sqlserver.sql
@@ -0,0 +1,28 @@
+
+-- create the requisite table
+
+CREATE TABLE BATCH_JOB_EXECUTION_PARAMS (
+ JOB_EXECUTION_ID BIGINT NOT NULL ,
+ TYPE_CD VARCHAR(6) NOT NULL ,
+ KEY_NAME VARCHAR(100) NOT NULL ,
+ STRING_VAL VARCHAR(250) ,
+ DATE_VAL DATETIME DEFAULT NULL ,
+ LONG_VAL BIGINT ,
+ DOUBLE_VAL DOUBLE PRECISION ,
+ IDENTIFYING CHAR(1) NOT NULL ,
+ constraint JOB_EXEC_PARAMS_FK foreign key (JOB_EXECUTION_ID)
+ references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID)
+) ;
+
+-- insert script that 'copies' existing batch_job_params to batch_job_execution_params
+-- sets new params to identifying ones
+-- verified on h2,
+
+INSERT INTO BATCH_JOB_EXECUTION_PARAMS
+ ( JOB_EXECUTION_ID , TYPE_CD, KEY_NAME, STRING_VAL, DATE_VAL, LONG_VAL, DOUBLE_VAL, IDENTIFYING )
+SELECT
+ JE.JOB_EXECUTION_ID , JP.TYPE_CD , JP.KEY_NAME , JP.STRING_VAL , JP.DATE_VAL , JP.LONG_VAL , JP.DOUBLE_VAL , 1
+FROM
+ BATCH_JOB_PARAMS JP,BATCH_JOB_EXECUTION JE
+WHERE
+ JP.JOB_INSTANCE_ID = JE.JOB_INSTANCE_ID;
View
28 ...c/main/resources/org/springframework/batch/core/2.1-to-2.2-migration/migration-sybase.sql
@@ -0,0 +1,28 @@
+
+-- create the requisite table
+
+CREATE TABLE BATCH_JOB_EXECUTION_PARAMS (
+ JOB_EXECUTION_ID BIGINT NOT NULL ,
+ TYPE_CD VARCHAR(6) NOT NULL ,
+ KEY_NAME VARCHAR(100) NOT NULL ,
+ STRING_VAL VARCHAR(250) NULL,
+ DATE_VAL DATETIME DEFAULT NULL NULL,
+ LONG_VAL BIGINT NULL,
+ DOUBLE_VAL DOUBLE PRECISION NULL,
+ IDENTIFYING CHAR(1) NOT NULL ,
+ constraint JOB_EXEC_PARAMS_FK foreign key (JOB_EXECUTION_ID)
+ references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID)
+) ;
+
+-- insert script that 'copies' existing batch_job_params to batch_job_execution_params
+-- sets new params to identifying ones
+-- verified on h2,
+
+INSERT INTO BATCH_JOB_EXECUTION_PARAMS
+ ( JOB_EXECUTION_ID , TYPE_CD, KEY_NAME, STRING_VAL, DATE_VAL, LONG_VAL, DOUBLE_VAL, IDENTIFYING )
+SELECT
+ JE.JOB_EXECUTION_ID , JP.TYPE_CD , JP.KEY_NAME , JP.STRING_VAL , JP.DATE_VAL , JP.LONG_VAL , JP.DOUBLE_VAL , 1
+FROM
+ BATCH_JOB_PARAMS JP,BATCH_JOB_EXECUTION JE
+WHERE
+ JP.JOB_INSTANCE_ID = JE.JOB_INSTANCE_ID;

0 comments on commit 5d88e03

Please sign in to comment.