From 4beba532206bc971e86a7af43f02c22e84715d43 Mon Sep 17 00:00:00 2001 From: Wayne Lund Date: Tue, 12 Feb 2013 23:11:36 -0800 Subject: [PATCH] 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. --- .../src/main/sql/drop.constraints.sql.vpp | 7 +++++++ .../src/main/sql/postgresql.properties | 1 + spring-batch-core/src/main/sql/sqlf.properties | 13 +++++++++++++ spring-batch-core/src/main/sql/sqlf.vpp | 3 +++ 4 files changed, 24 insertions(+) create mode 100644 spring-batch-core/src/main/sql/drop.constraints.sql.vpp create mode 100644 spring-batch-core/src/main/sql/sqlf.properties create mode 100644 spring-batch-core/src/main/sql/sqlf.vpp diff --git a/spring-batch-core/src/main/sql/drop.constraints.sql.vpp b/spring-batch-core/src/main/sql/drop.constraints.sql.vpp new file mode 100644 index 000000000..cdeb14c42 --- /dev/null +++ b/spring-batch-core/src/main/sql/drop.constraints.sql.vpp @@ -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; + diff --git a/spring-batch-core/src/main/sql/postgresql.properties b/spring-batch-core/src/main/sql/postgresql.properties index 8d51883a7..f2b744e1a 100644 --- a/spring-batch-core/src/main/sql/postgresql.properties +++ b/spring-batch-core/src/main/sql/postgresql.properties @@ -3,6 +3,7 @@ platform=postgresql BIGINT = BIGINT IDENTITY = GENERATED = +IFEXISTSBEFORE = IF EXISTS DOUBLE = DOUBLE PRECISION BLOB = BYTEA CLOB = TEXT diff --git a/spring-batch-core/src/main/sql/sqlf.properties b/spring-batch-core/src/main/sql/sqlf.properties new file mode 100644 index 000000000..ff40f7be0 --- /dev/null +++ b/spring-batch-core/src/main/sql/sqlf.properties @@ -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 diff --git a/spring-batch-core/src/main/sql/sqlf.vpp b/spring-batch-core/src/main/sql/sqlf.vpp new file mode 100644 index 000000000..8e346ba00 --- /dev/null +++ b/spring-batch-core/src/main/sql/sqlf.vpp @@ -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