From ee60f38f90c11f2c3989803b4f1c72fcdc125d09 Mon Sep 17 00:00:00 2001 From: Andreas Falk Date: Thu, 4 Sep 2014 20:32:46 +0200 Subject: [PATCH] INT-3510: Fixed 'missing INT_MESSAGE_SEQ' error JIRA: https://jira.spring.io/browse/INT-3510 There has been an error in schema creation scipt for message store on postgresql database: The statement for creating sequence 'INT_MESSAGE_SEQ' was executed AFTER creating the table that actually uses this sequence which resulted in sequence not found error. Further problem was that the the corresponding index 'MSG_INDEX_DATE_IDX' in creation script does not match the index name 'INT_CHANNEL_MSG_DATE_IDX' in drop script. Therfore an error occurred when executing drop schema script for postgresql. Fixes: 1.Moved creation of sequence 'INT_MESSAGE_SEQ' to first line to be executed before creating the corresponding table 2.Renamed index 'MSG_INDEX_DATE_IDX' to 'INT_CHANNEL_MSG_DATE_IDX' in create script to make drop script work again On branch INT-3510 --- .../integration/jdbc/store/channel/schema-drop-postgres.sql | 2 +- .../integration/jdbc/store/channel/schema-postgresql.sql | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-drop-postgres.sql b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-drop-postgres.sql index 257045f2f4..ec9ec7b33a 100644 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-drop-postgres.sql +++ b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-drop-postgres.sql @@ -1,4 +1,4 @@ -DROP TABLE INT_CHANNEL_MESSAGE; DROP INDEX INT_CHANNEL_MSG_DATE_IDX; DROP INDEX INT_CHANNEL_MSG_PRIORITY_IDX; +DROP TABLE INT_CHANNEL_MESSAGE; DROP SEQUENCE INT_MESSAGE_SEQ; diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-postgresql.sql b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-postgresql.sql index f0edc5dc41..c255a3dd82 100644 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-postgresql.sql +++ b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-postgresql.sql @@ -1,3 +1,5 @@ +CREATE SEQUENCE INT_MESSAGE_SEQ START WITH 1 INCREMENT BY 1 NO CYCLE; + CREATE TABLE INT_CHANNEL_MESSAGE ( MESSAGE_ID character(36) NOT NULL, GROUP_KEY character(36) NOT NULL, @@ -9,7 +11,7 @@ CREATE TABLE INT_CHANNEL_MESSAGE ( constraint INT_CHANNEL_MESSAGE_PK primary key (GROUP_KEY, MESSAGE_ID, REGION) ); -CREATE INDEX MSG_INDEX_DATE_IDX ON INT_CHANNEL_MESSAGE USING btree (CREATED_DATE, MESSAGE_SEQUENCE); +CREATE INDEX INT_CHANNEL_MSG_DATE_IDX ON INT_CHANNEL_MESSAGE USING btree (CREATED_DATE, MESSAGE_SEQUENCE); CREATE INDEX INT_CHANNEL_MSG_PRIORITY_IDX ON INT_CHANNEL_MESSAGE USING btree (MESSAGE_PRIORITY DESC, CREATED_DATE, MESSAGE_SEQUENCE); -CREATE SEQUENCE INT_MESSAGE_SEQ START WITH 1 INCREMENT BY 1 NO CYCLE; +