Merge pull request #120 from wxlund/BATCH-1960
* BATCH-1960: BATCH-1960: Removed cascades and updated .vpp files Failed to add all of the files in the previous commit. These are the other additional changes made. Made changes to generate-sql. Do not understand how we copy from generated-sources to /src/main/resources but the generation has fixed all of the same bugs that were manually fixed in /src/main/resources including the preferred approach, drop contraints for postgresql. Fixed issue of "drop table" scripts causing tests to fail in samples. Only done for sqlfire and postgres. I believe others that do not have the "if exists" statements in their drop tables scripts should be retested as I have not had to do this on any other previous version. Suspect that "continueOnError" default flag has somehow gotten flipped.
This commit is contained in:
@@ -188,8 +188,22 @@
|
||||
</engine>
|
||||
</config>
|
||||
<fileset dir="${basedir}/src/main/sql" includes="schema*.sql.vpp" />
|
||||
<mapper type="glob" from="*.sql.vpp" to="*-derby.sql" />
|
||||
<mapper type="glob" from="*.sql.vpp" to="*-sqlf.sql" />
|
||||
</vppcopy>
|
||||
<vppcopy todir="${basedir}/target/generated-resources" overwrite="true">
|
||||
<config>
|
||||
<context>
|
||||
<property key="includes" value="src/main/sql" />
|
||||
<property file="${basedir}/src/main/sql/sqlf.properties" />
|
||||
</context>
|
||||
<engine>
|
||||
<property key="velocimacro.library" value="src/main/sql/sqlf.vpp" />
|
||||
</engine>
|
||||
</config>
|
||||
<fileset dir="${basedir}/src/main/sql" includes="schema*.sql.vpp" />
|
||||
<mapper type="glob" from="*.sql.vpp" to="*-sqlf.sql" />
|
||||
</vppcopy>
|
||||
|
||||
<vppcopy todir="${basedir}/target/generated-resources" overwrite="true">
|
||||
<config>
|
||||
<context>
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
-- Autogenerated: do not edit this file
|
||||
ALTER TABLE BATCH_JOB_INSTANCE DROP CONSTRAINT IF EXISTS JOB_INST_UN;
|
||||
ALTER TABLE BATCH_JOB_EXECUTION DROP CONSTRAINT IF EXISTS JOB_INST_EXEC_FK;
|
||||
ALTER TABLE BATCH_JOB_EXECUTION_PARAMS DROP CONSTRAINT IF EXISTS JOB_EXEC_PARAMS_FK;
|
||||
ALTER TABLE BATCH_STEP_EXECUTION DROP CONSTRAINT IF EXISTS JOB_EXEC_STEP_FK;
|
||||
ALTER TABLE BATCH_STEP_EXECUTION_CONTEXT DROP CONSTRAINT IF EXISTS STEP_EXEC_CTX_FK;
|
||||
ALTER TABLE BATCH_JOB_EXECUTION_CONTEXT DROP CONSTRAINT IF EXISTS JOB_EXEC_CTX_FK;
|
||||
|
||||
DROP TABLE BATCH_STEP_EXECUTION_CONTEXT ;
|
||||
DROP TABLE BATCH_JOB_EXECUTION_CONTEXT ;
|
||||
DROP TABLE BATCH_STEP_EXECUTION ;
|
||||
DROP TABLE BATCH_JOB_EXECUTION_PARAMS ;
|
||||
DROP TABLE BATCH_JOB_EXECUTION ;
|
||||
DROP TABLE BATCH_JOB_INSTANCE ;
|
||||
DROP TABLE IF EXISTS BATCH_STEP_EXECUTION_CONTEXT;
|
||||
DROP TABLE IF EXISTS BATCH_JOB_EXECUTION_CONTEXT;
|
||||
DROP TABLE IF EXISTS BATCH_STEP_EXECUTION;
|
||||
DROP TABLE IF EXISTS BATCH_JOB_EXECUTION_PARAMS;
|
||||
DROP TABLE IF EXISTS BATCH_JOB_EXECUTION;
|
||||
DROP TABLE IF EXISTS BATCH_JOB_INSTANCE;
|
||||
|
||||
DROP SEQUENCE BATCH_STEP_EXECUTION_SEQ ;
|
||||
DROP SEQUENCE BATCH_JOB_EXECUTION_SEQ ;
|
||||
DROP SEQUENCE BATCH_JOB_SEQ ;
|
||||
DROP SEQUENCE IF EXISTS BATCH_STEP_EXECUTION_SEQ ;
|
||||
DROP SEQUENCE IF EXISTS BATCH_JOB_EXECUTION_SEQ ;
|
||||
DROP SEQUENCE IF EXISTS BATCH_JOB_SEQ ;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
-- Autogenerated: do not edit this file
|
||||
|
||||
DROP TABLE BATCH_STEP_EXECUTION_CONTEXT ;
|
||||
DROP TABLE BATCH_JOB_EXECUTION_CONTEXT ;
|
||||
DROP TABLE BATCH_STEP_EXECUTION ;
|
||||
DROP TABLE BATCH_JOB_EXECUTION_PARAMS ;
|
||||
DROP TABLE BATCH_JOB_EXECUTION ;
|
||||
DROP TABLE BATCH_JOB_INSTANCE ;
|
||||
DROP TABLE IF EXISTS BATCH_STEP_EXECUTION_CONTEXT ;
|
||||
DROP TABLE IF EXISTS BATCH_JOB_EXECUTION_CONTEXT ;
|
||||
DROP TABLE IF EXISTS BATCH_STEP_EXECUTION ;
|
||||
DROP TABLE IF EXISTS BATCH_JOB_EXECUTION_PARAMS ;
|
||||
DROP TABLE IF EXISTS BATCH_JOB_EXECUTION ;
|
||||
DROP TABLE IF EXISTS BATCH_JOB_INSTANCE ;
|
||||
|
||||
DROP TABLE BATCH_STEP_EXECUTION_SEQ ;
|
||||
DROP TABLE BATCH_JOB_EXECUTION_SEQ ;
|
||||
DROP TABLE BATCH_JOB_SEQ ;
|
||||
DROP TABLE IF EXISTS BATCH_STEP_EXECUTION_SEQ ;
|
||||
DROP TABLE IF EXISTS BATCH_JOB_EXECUTION_SEQ ;
|
||||
DROP TABLE IF EXISTS BATCH_JOB_SEQ ;
|
||||
|
||||
@@ -31,6 +31,7 @@ CREATE TABLE BATCH_JOB_EXECUTION_PARAMS (
|
||||
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)
|
||||
) ;
|
||||
|
||||
7
spring-batch-core/src/main/sql/drop.constraints.sql.vpp
Normal file
7
spring-batch-core/src/main/sql/drop.constraints.sql.vpp
Normal file
@@ -0,0 +1,7 @@
|
||||
ALTER TABLE BATCH_JOB_INSTANCE DROP CONSTRAINT ${IFEXISTSBEFORE} JOB_INST_UN;
|
||||
ALTER TABLE BATCH_JOB_EXECUTION DROP CONSTRAINT ${IFEXISTSBEFORE} JOB_INST_EXEC_FK;
|
||||
ALTER TABLE BATCH_JOB_EXECUTION_PARAMS DROP CONSTRAINT ${IFEXISTSBEFORE} JOB_EXEC_PARAMS_FK;
|
||||
ALTER TABLE BATCH_STEP_EXECUTION DROP CONSTRAINT ${IFEXISTSBEFORE} JOB_EXEC_STEP_FK;
|
||||
ALTER TABLE BATCH_STEP_EXECUTION_CONTEXT DROP CONSTRAINT ${IFEXISTSBEFORE} STEP_EXEC_CTX_FK;
|
||||
ALTER TABLE BATCH_JOB_EXECUTION_CONTEXT DROP CONSTRAINT ${IFEXISTSBEFORE} JOB_EXEC_CTX_FK;
|
||||
|
||||
@@ -3,6 +3,8 @@ platform=postgresql
|
||||
BIGINT = BIGINT
|
||||
IDENTITY =
|
||||
GENERATED =
|
||||
IFEXISTSBEFORE = IF EXISTS
|
||||
DROPCONSTRAINT = TRUE
|
||||
DOUBLE = DOUBLE PRECISION
|
||||
BLOB = BYTEA
|
||||
CLOB = TEXT
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#macro (alter $name $table $constraint) ALTER TABLE ${name} DROP CONSTRAINT IF EXISTS ${constraint};
|
||||
#end
|
||||
#macro (sequence $name $value)CREATE SEQUENCE ${name} MAXVALUE 9223372036854775807 NO CYCLE;
|
||||
#end
|
||||
#macro (notnull $name $type)ALTER COLUMN ${name} SET NOT NULL#end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
-- Autogenerated: do not edit this file
|
||||
|
||||
## Done so that we didn't have to modify all of the other files besides postgresql
|
||||
#if (!$DROPCONSTRAINT) #set($DROPCONSTRAINT = "FALSE") #end
|
||||
#if ( $DROPCONSTRAINT == "TRUE") #parse("${includes}/drop.constraints.sql.vpp") #end
|
||||
#parse("${includes}/destroy.sql.vpp")
|
||||
|
||||
@@ -23,16 +23,17 @@ CREATE TABLE BATCH_JOB_EXECUTION (
|
||||
references BATCH_JOB_INSTANCE(JOB_INSTANCE_ID)
|
||||
) $!{VOODOO};
|
||||
|
||||
CREATE TABLE BATCH_JOB_PARAMS (
|
||||
JOB_INSTANCE_ID ${BIGINT} NOT NULL ,
|
||||
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 ${TIMESTAMP} DEFAULT NULL $!{NULL},
|
||||
LONG_VAL ${BIGINT} $!{NULL},
|
||||
DOUBLE_VAL ${DOUBLE} $!{NULL},
|
||||
constraint JOB_INST_PARAMS_FK foreign key (JOB_INSTANCE_ID)
|
||||
references BATCH_JOB_INSTANCE(JOB_INSTANCE_ID)
|
||||
IDENTIFYING ${CHAR}(1) NOT NULL ,
|
||||
constraint JOB_EXEC_PARAMS_FK foreign key (JOB_EXECUTION_ID)
|
||||
references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID)
|
||||
) $!{VOODOO};
|
||||
|
||||
CREATE TABLE BATCH_STEP_EXECUTION (
|
||||
|
||||
13
spring-batch-core/src/main/sql/sqlf.properties
Normal file
13
spring-batch-core/src/main/sql/sqlf.properties
Normal file
@@ -0,0 +1,13 @@
|
||||
platform=sqlfire
|
||||
# SQL language oddities (cloned from Derby)
|
||||
BIGINT = BIGINT
|
||||
IDENTITY =
|
||||
GENERATED = GENERATED BY DEFAULT AS IDENTITY
|
||||
IFEXISTSBEFORE = IF EXISTS
|
||||
DOUBLE = DOUBLE PRECISION
|
||||
BLOB = BLOB
|
||||
CLOB = CLOB
|
||||
TIMESTAMP = TIMESTAMP
|
||||
VARCHAR = VARCHAR
|
||||
# for generating drop statements...
|
||||
SEQUENCE = TABLE
|
||||
3
spring-batch-core/src/main/sql/sqlf.vpp
Normal file
3
spring-batch-core/src/main/sql/sqlf.vpp
Normal file
@@ -0,0 +1,3 @@
|
||||
#macro (sequence $name $value)CREATE TABLE ${name} (ID BIGINT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, DUMMY VARCHAR(1));
|
||||
#end
|
||||
#macro (notnull $name $type)ALTER COLUMN ${name} NOT NULL#end
|
||||
@@ -189,9 +189,8 @@
|
||||
<dependency>
|
||||
<groupId>postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>8.3-603.jdbc3</version>
|
||||
<version>9.1-901.jdbc4</version>
|
||||
<optional>true</optional>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
# Placeholders batch.*
|
||||
# for Postgres:
|
||||
batch.jdbc.driver=org.postgresql.Driver
|
||||
batch.jdbc.url=jdbc:postgresql://localhost/samples
|
||||
batch.jdbc.user=postgres
|
||||
batch.jdbc.password=dba
|
||||
batch.jdbc.testWhileIdle=false
|
||||
batch.jdbc.validationQuery=
|
||||
batch.jdbc.verifyCursorPosition=false
|
||||
batch.drop.script=classpath:/org/springframework/batch/core/schema-drop-postgresql.sql
|
||||
batch.schema.script=classpath:/org/springframework/batch/core/schema-postgresql.sql
|
||||
batch.business.schema.script=business-schema-postgresql.sql
|
||||
batch.data.source.init=true
|
||||
batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.PostgreSQLSequenceMaxValueIncrementer
|
||||
batch.database.incrementer.parent=sequenceIncrementerParent
|
||||
batch.lob.handler.class=org.springframework.jdbc.support.lob.DefaultLobHandler
|
||||
batch.grid.size=2
|
||||
batch.jdbc.pool.size=6
|
||||
batch.verify.cursor.position=false
|
||||
batch.isolationlevel=ISOLATION_SERIALIZABLE
|
||||
@@ -1,5 +1,5 @@
|
||||
# Placeholders batch.*
|
||||
# for Derby:
|
||||
# for SQLFire:
|
||||
batch.jdbc.driver=com.vmware.sqlfire.jdbc.ClientDriver
|
||||
batch.jdbc.url=jdbc:sqlfire://localhost:1257/;update=true
|
||||
batch.jdbc.user=SAMPLES
|
||||
@@ -7,7 +7,7 @@ batch.jdbc.password=SAMPLES
|
||||
batch.jdbc.testWhileIdle=false
|
||||
batch.jdbc.validationQuery=
|
||||
batch.jdbc.verifyCursorPosition=false
|
||||
batch.drop.script=classpath:/org/springframework/batch/core/schema-drop-derby.sql
|
||||
batch.drop.script=classpath:/org/springframework/batch/core/schema-drop-sqlf.sql
|
||||
batch.schema.script=classpath:/org/springframework/batch/core/schema-sqlf.sql
|
||||
batch.business.schema.script=business-schema-sqlf.sql
|
||||
batch.data.source.init=true
|
||||
@@ -17,4 +17,6 @@ batch.lob.handler.class=org.springframework.jdbc.support.lob.DefaultLobHandler
|
||||
batch.grid.size=2
|
||||
batch.jdbc.pool.size=6
|
||||
batch.verify.cursor.position=false
|
||||
#add this for your jobRepository bean p:isolationLevelForCreate = "${batch.isolationlevel}"
|
||||
#see simple-job-launcher-context.xml for example
|
||||
batch.isolationlevel=ISOLATION_READ_COMMITTED
|
||||
@@ -1,14 +1,14 @@
|
||||
-- Autogenerated: do not edit this file
|
||||
DROP SEQUENCE BATCH_STAGING_SEQ ;
|
||||
DROP SEQUENCE TRADE_SEQ ;
|
||||
DROP SEQUENCE CUSTOMER_SEQ ;
|
||||
DROP TABLE BATCH_STAGING ;
|
||||
DROP TABLE TRADE ;
|
||||
DROP TABLE CUSTOMER ;
|
||||
DROP TABLE PLAYERS ;
|
||||
DROP TABLE GAMES ;
|
||||
DROP TABLE PLAYER_SUMMARY ;
|
||||
DROP TABLE ERROR_LOG ;
|
||||
DROP SEQUENCE IF EXISTS BATCH_STAGING_SEQ ;
|
||||
DROP SEQUENCE IF EXISTS TRADE_SEQ ;
|
||||
DROP SEQUENCE IF EXISTS CUSTOMER_SEQ ;
|
||||
DROP TABLE IF EXISTS BATCH_STAGING ;
|
||||
DROP TABLE IF EXISTS TRADE ;
|
||||
DROP TABLE IF EXISTS CUSTOMER ;
|
||||
DROP TABLE IF EXISTS PLAYERS ;
|
||||
DROP TABLE IF EXISTS GAMES ;
|
||||
DROP TABLE IF EXISTS PLAYER_SUMMARY ;
|
||||
DROP TABLE IF EXISTS ERROR_LOG ;
|
||||
|
||||
-- Autogenerated: do not edit this file
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
-- Autogenerated: do not edit this file
|
||||
-- You might need to remove this section the first time you run against a clean database
|
||||
DROP TABLE BATCH_STAGING_SEQ ;
|
||||
DROP TABLE TRADE_SEQ ;
|
||||
DROP TABLE CUSTOMER_SEQ ;
|
||||
DROP TABLE BATCH_STAGING ;
|
||||
DROP TABLE TRADE ;
|
||||
DROP TABLE CUSTOMER ;
|
||||
DROP TABLE PLAYERS ;
|
||||
DROP TABLE GAMES ;
|
||||
DROP TABLE PLAYER_SUMMARY ;
|
||||
DROP TABLE ERROR_LOG ;
|
||||
DROP TABLE IF EXISTS BATCH_STAGING_SEQ ;
|
||||
DROP TABLE IF EXISTS TRADE_SEQ ;
|
||||
DROP TABLE IF EXISTS CUSTOMER_SEQ ;
|
||||
DROP TABLE IF EXISTS BATCH_STAGING ;
|
||||
DROP TABLE IF EXISTS TRADE ;
|
||||
DROP TABLE IF EXISTS CUSTOMER ;
|
||||
DROP TABLE IF EXISTS PLAYERS ;
|
||||
DROP TABLE IF EXISTS GAMES ;
|
||||
DROP TABLE IF EXISTS PLAYER_SUMMARY ;
|
||||
DROP TABLE IF EXISTS ERROR_LOG ;
|
||||
|
||||
-- Autogenerated: do not edit this file
|
||||
|
||||
|
||||
Reference in New Issue
Block a user