Skip to content

Commit

Permalink
added jdbc-initialize-database to create massage tables if they don't…
Browse files Browse the repository at this point in the history
… exist
  • Loading branch information
Thomas Risberg committed Aug 31, 2011
1 parent c03fec6 commit a77f069
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions wgrus/wgrus-store/src/main/resources/root-context.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int="http://www.springframework.org/schema/integration"
xmlns:amqp="http://www.springframework.org/schema/integration/amqp"
xmlns:rabbit="http://www.springframework.org/schema/rabbit"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util" xmlns:cloud="http://schema.cloudfoundry.org/spring"
xsi:schemaLocation="http://www.springframework.org/schema/integration/amqp http://www.springframework.org/schema/integration/amqp/spring-integration-amqp-2.0.xsd
http://schema.cloudfoundry.org/spring http://schema.cloudfoundry.org/spring/cloudfoundry-spring-0.6.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd
http://www.springframework.org/schema/rabbit http://www.springframework.org/schema/rabbit/spring-rabbit-1.0.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
Expand All @@ -28,6 +30,9 @@
<bean id="messageStore" class="org.springframework.integration.jdbc.JdbcMessageStore">
<constructor-arg ref="dataSource"/>
</bean>
<jdbc:initialize-database data-source="dataSource">
<jdbc:script location="classpath:setup.sql"/>
</jdbc:initialize-database>

<!--
<bean id="messageStore"
Expand Down
19 changes: 19 additions & 0 deletions wgrus/wgrus-store/src/main/resources/setup.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
-- Create MySQL message tables if they don't exist

CREATE TABLE IF NOT EXISTS INT_MESSAGE (
MESSAGE_ID CHAR(36) NOT NULL PRIMARY KEY,
REGION VARCHAR(100),
CREATED_DATE DATETIME NOT NULL,
MESSAGE_BYTES BLOB
) ENGINE=InnoDB;

CREATE TABLE IF NOT EXISTS INT_MESSAGE_GROUP (
MESSAGE_ID CHAR(36) NOT NULL,
GROUP_KEY CHAR(36) NOT NULL,
REGION VARCHAR(100),
MARKED BIGINT,
CREATED_DATE DATETIME NOT NULL,
UPDATED_DATE DATETIME DEFAULT NULL,
MESSAGE_BYTES BLOB,
constraint MESSAGE_GROUP_PK primary key (MESSAGE_ID, GROUP_KEY)
) ENGINE=InnoDB;

0 comments on commit a77f069

Please sign in to comment.