Liquibase Spring batch xml for Oracle RDBMS

Reading Time: 2 minutes

 

[code]

<?xml version=”1.0″ encoding=”UTF-8″?>
<databaseChangeLog xmlns=”http://www.liquibase.org/xml/ns/dbchangelog” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xsi:schemaLocation=”http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd”>
<changeSet id=”1.0.0_SPRING_BATCH_INFRASTRUCTURE” author=”a243229″>
<createSequence sequenceName=”BATCH_STEP_EXECUTION_SEQ” startValue=”0″ minValue=”0″ maxValue=”9223372036854775807″ cycle=”false” />
<createSequence sequenceName=”BATCH_JOB_EXECUTION_SEQ” startValue=”0″ minValue=”0″ maxValue=”9223372036854775807″ cycle=”false” />
<createSequence sequenceName=”BATCH_JOB_SEQ” startValue=”0″ minValue=”0″ maxValue=”9223372036854775807″ cycle=”false” />

<createTable tableName=”BATCH_JOB_INSTANCE”>
<column name=”JOB_INSTANCE_ID” type=”BIGINT”>
<constraints primaryKey=”true” nullable=”false” />
</column>
<column name=”VERSION” type=”BIGINT” />
<column name=”JOB_NAME” type=”VARCHAR(100)”>
<constraints nullable=”false” />
</column>
<column name=”JOB_KEY” type=”VARCHAR(32)”>
<constraints nullable=”false” />
</column>
</createTable>

<addUniqueConstraint constraintName=”JOB_INST_UN” columnNames=”JOB_NAME, JOB_KEY” tableName=”BATCH_JOB_INSTANCE” />

<createTable tableName=”BATCH_JOB_EXECUTION”>
<column name=”JOB_EXECUTION_ID” type=”BIGINT”>
<constraints primaryKey=”true” nullable=”false” />
</column>
<column name=”VERSION” type=”BIGINT” />
<column name=”JOB_INSTANCE_ID” type=”BIGINT”>
<constraints nullable=”false” />
</column>
<column name=”CREATE_TIME” type=”DATETIME”>
<constraints nullable=”false” />
</column>
<column name=”START_TIME” type=”DATETIME”>
<constraints nullable=”true” />
</column>
<column name=”END_TIME” type=”DATETIME”>
<constraints nullable=”true” />
</column>
<column name=”STATUS” type=”VARCHAR(10)” />
<column name=”EXIT_CODE” type=”VARCHAR(2500)” />
<column name=”EXIT_MESSAGE” type=”VARCHAR(2500)” />
<column name=”LAST_UPDATED” type=”DATETIME” />
<column name=”JOB_CONFIGURATION_LOCATION” type=”VARCHAR(2500)”>
<constraints nullable=”true” />
</column>
</createTable>

<addForeignKeyConstraint baseTableName=”BATCH_JOB_EXECUTION” baseColumnNames=”JOB_INSTANCE_ID” constraintName=”JOB_INST_EXEC_FK”
referencedTableName=”BATCH_JOB_INSTANCE” referencedColumnNames=”JOB_INSTANCE_ID” />

<createTable tableName=”BATCH_JOB_EXECUTION_PARAMS”>
<column name=”JOB_EXECUTION_ID” type=”BIGINT”>
<constraints nullable=”false” />
</column>
<column name=”TYPE_CD” type=”VARCHAR(6)”>
<constraints nullable=”false” />
</column>
<column name=”KEY_NAME” type=”VARCHAR(100)”>
<constraints nullable=”false” />
</column>
<column name=”STRING_VAL” type=”VARCHAR(250)” />
<column name=”DATE_VAL” type=”DATETIME”>
<constraints nullable=”true” />
</column>
<column name=”LONG_VAL” type=”BIGINT” />
<column name=”DOUBLE_VAL” type=”BIGINT” />
<column name=”IDENTIFYING” type=”VARCHAR(1)”>
<constraints nullable=”false” />
</column>
</createTable>

<addForeignKeyConstraint baseTableName=”BATCH_JOB_EXECUTION_PARAMS” baseColumnNames=”JOB_EXECUTION_ID” constraintName=”JOB_EXEC_PARAMS_FK”
referencedTableName=”BATCH_JOB_EXECUTION” referencedColumnNames=”JOB_EXECUTION_ID” />

<createTable tableName=”BATCH_STEP_EXECUTION”>
<column name=”STEP_EXECUTION_ID” type=”BIGINT”>
<constraints primaryKey=”true” nullable=”false” />
</column>
<column name=”VERSION” type=”BIGINT”>
<constraints nullable=”false” />
</column>
<column name=”STEP_NAME” type=”VARCHAR(100)”>
<constraints nullable=”false” />
</column>
<column name=”JOB_EXECUTION_ID” type=”BIGINT”>
<constraints nullable=”false” />
</column>
<column name=”START_TIME” type=”DATETIME”>
<constraints nullable=”false” />
</column>
<column name=”END_TIME” type=”DATETIME”>
<constraints nullable=”true” />
</column>
<column name=”STATUS” type=”VARCHAR(10)” />
<column name=”COMMIT_COUNT” type=”BIGINT” />
<column name=”READ_COUNT” type=”BIGINT” />
<column name=”FILTER_COUNT” type=”BIGINT” />
<column name=”WRITE_COUNT” type=”BIGINT” />
<column name=”READ_SKIP_COUNT” type=”BIGINT” />
<column name=”WRITE_SKIP_COUNT” type=”BIGINT” />
<column name=”PROCESS_SKIP_COUNT” type=”BIGINT” />
<column name=”ROLLBACK_COUNT” type=”BIGINT” />
<column name=”EXIT_CODE” type=”VARCHAR(2500)” />
<column name=”EXIT_MESSAGE” type=”VARCHAR(2500)” />
<column name=”LAST_UPDATED” type=”DATETIME” />
</createTable>

<addForeignKeyConstraint baseTableName=”BATCH_JOB_EXECUTION” baseColumnNames=”JOB_EXECUTION_ID” constraintName=”JOB_EXEC_STEP_FK”
referencedTableName=”BATCH_JOB_EXECUTION” referencedColumnNames=”JOB_EXECUTION_ID” />

<createTable tableName=”BATCH_STEP_EXECUTION_CONTEXT”>
<column name=”STEP_EXECUTION_ID” type=”BIGINT”>
<constraints primaryKey=”true” nullable=”false” />
</column>
<column name=”SHORT_CONTEXT” type=”VARCHAR(2500)”>
<constraints nullable=”false” />
</column>
<column name=”SERIALIZED_CONTEXT” type=”CLOB” />
</createTable>
<addForeignKeyConstraint baseTableName=”BATCH_STEP_EXECUTION_CONTEXT” baseColumnNames=”STEP_EXECUTION_ID” constraintName=”STEP_EXEC_CTX_FK”
referencedTableName=”BATCH_STEP_EXECUTION” referencedColumnNames=”STEP_EXECUTION_ID” />

<createTable tableName=”BATCH_JOB_EXECUTION_CONTEXT”>
<column name=”JOB_EXECUTION_ID” type=”BIGINT”>
<constraints primaryKey=”true” nullable=”false” />
</column>
<column name=”SHORT_CONTEXT” type=”VARCHAR(2500)”>
<constraints nullable=”false” />
</column>
<column name=”SERIALIZED_CONTEXT” type=”CLOB” />
</createTable>

<addForeignKeyConstraint baseTableName=”BATCH_JOB_EXECUTION_CONTEXT” baseColumnNames=”JOB_EXECUTION_ID” constraintName=”JOB_EXEC_CTX_FK”
referencedTableName=”BATCH_JOB_EXECUTION” referencedColumnNames=”JOB_EXECUTION_ID” />

</changeSet>
</databaseChangeLog>

[/code]

Leave a Reply

Your email address will not be published. Required fields are marked *