Spring Batch
  1. Spring Batch
  2. BATCH-1977

Create a migration from old schema to new schema

    Details

    • Type: Task Task
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Complete
    • Affects Version/s: None
    • Fix Version/s: 2.2.0, 2.2.0 - Sprint 19
    • Component/s: Core
    • Labels:
      None

      Description

      The repository schema for 2.2 has changed to support non-identifying parameters. We need a migration to migrate job data from the old version to the new version.

        Activity

        Hide
        Will Schipp added a comment -

        this task could be achieved with a sql script similar to the following

        insert into batch_job_execution_params (job_execution_id,type_cd,key_name,string_val,date_val,long_val,double_val, identifying) 
        select (
           select min(job_execution_id) from batch_job_execution je, batch_job_params jp where jp.job_instance_id  = je.job_instance_id and je.job_instance_id = j.job_instance_id),
        j.type_cd, j.key_name, j.string_val, j.date_val, j.long_val, j.double_val,1 from batch_job_params j;
        

        this would work under the following assumptions;

        • there are no naming conflicts between the old batch_job_params and batch_job_execution_params
        • all old params should be identifying params in the new structure
        • no conflict with identifying keys
        • the execution id to be used (in place of instance id) is the 'first' (min) for the job_instance
        Show
        Will Schipp added a comment - this task could be achieved with a sql script similar to the following insert into batch_job_execution_params (job_execution_id,type_cd,key_name,string_val,date_val,long_val,double_val, identifying) select ( select min(job_execution_id) from batch_job_execution je, batch_job_params jp where jp.job_instance_id = je.job_instance_id and je.job_instance_id = j.job_instance_id), j.type_cd, j.key_name, j.string_val, j.date_val, j.long_val, j.double_val,1 from batch_job_params j; this would work under the following assumptions; there are no naming conflicts between the old batch_job_params and batch_job_execution_params all old params should be identifying params in the new structure no conflict with identifying keys the execution id to be used (in place of instance id) is the 'first' (min) for the job_instance
        Hide
        Will Schipp added a comment -

        PR #144 - added a new script 2.1-to-2.2-migration.sql

        Show
        Will Schipp added a comment - PR #144 - added a new script 2.1-to-2.2-migration.sql
        Hide
        Will Schipp added a comment -

        PR #148 - added scripts for each database that includes the table and insert along with a standalone insert only file.

        Show
        Will Schipp added a comment - PR #148 - added scripts for each database that includes the table and insert along with a standalone insert only file.
        Hide
        Jimmy Praet added a comment -

        The migration scripts for Derby and DB2 are missing.

        pull request: https://github.com/SpringSource/spring-batch/pull/187

        Show
        Jimmy Praet added a comment - The migration scripts for Derby and DB2 are missing. pull request: https://github.com/SpringSource/spring-batch/pull/187

          People

          • Assignee:
            Michael Minella
            Reporter:
            Michael Minella
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 1d
              1d
              Remaining:
              Remaining Estimate - 1d
              1d
              Logged:
              Time Spent - Not Specified
              Not Specified