[jbpm-commits] JBoss JBPM SVN: r5481 - in jbpm4/trunk/modules/db: scripts and 1 other directory.
do-not-reply at jboss.org
do-not-reply at jboss.org
Fri Aug 14 23:29:25 EDT 2009
Author: alex.guizar at jboss.com
Date: 2009-08-14 23:29:25 -0400 (Fri, 14 Aug 2009)
New Revision: 5481
Modified:
jbpm4/trunk/modules/db/pom.xml
jbpm4/trunk/modules/db/scripts/antrun-schema.xml
jbpm4/trunk/modules/db/scripts/antrun-upgrade.xml
Log:
[JBPM-1995] build script to calculate jBPM DB differences
generate schema update script and diff between schema creation scripts
Modified: jbpm4/trunk/modules/db/pom.xml
===================================================================
--- jbpm4/trunk/modules/db/pom.xml 2009-08-14 10:04:17 UTC (rev 5480)
+++ jbpm4/trunk/modules/db/pom.xml 2009-08-15 03:29:25 UTC (rev 5481)
@@ -71,7 +71,7 @@
<goal>run</goal>
</goals>
<configuration>
- <tasks>
+ <tasks>
<property name="project.output.dir" value="${project.build.outputDirectory}"/>
<property name="previous.version.dir" value="${previous.version.directory}"/>
<ant antfile="scripts/antrun-upgrade.xml" target="upgrade-schema" inheritRefs="yes"/>
@@ -84,7 +84,7 @@
</build>
<properties>
- <previous.version.directory>${project.build.directory}/previous</previous.version.directory>
+ <previous.version.directory>${project.build.directory}/${jbpm.previous.version}</previous.version.directory>
</properties>
</profile>
</profiles>
Modified: jbpm4/trunk/modules/db/scripts/antrun-schema.xml
===================================================================
--- jbpm4/trunk/modules/db/scripts/antrun-schema.xml 2009-08-14 10:04:17 UTC (rev 5480)
+++ jbpm4/trunk/modules/db/scripts/antrun-schema.xml 2009-08-15 03:29:25 UTC (rev 5481)
@@ -10,57 +10,59 @@
<project>
- <!-- ================================================================== -->
- <!-- jBPM Database schema -->
- <!-- ================================================================== -->
+ <!-- ================================================================== -->
+ <!-- jBPM Database schema -->
+ <!-- ================================================================== -->
- <target name="create-schema">
- <taskdef name="schemaexport"
- classname="org.hibernate.tool.hbm2ddl.SchemaExportTask"
- classpathref="maven.compile.classpath" />
+ <target name="create-schema">
+ <taskdef name="schemaexport"
+ classname="org.hibernate.tool.hbm2ddl.SchemaExportTask"
+ classpathref="maven.compile.classpath" />
- <!-- HsqlDB -->
- <create-ddl db="hsqldb"/>
+ <mkdir dir="${project.output.dir}" />
- <!-- MySQL -->
- <create-ddl db="mysql"/>
- <!--TODO: https://jira.jboss.org/jira/browse/JBPM-2071 -->
- <replace file="${project.output.dir}/jbpm.mysql.create.sql" token="BLOB_VALUE_ blob" value="BLOB_VALUE_ longblob" />
+ <!-- HsqlDB -->
+ <create-ddl db="hsqldb" />
- <!-- Oracle -->
- <create-ddl db="oracle"/>
+ <!-- MySQL -->
+ <create-ddl db="mysql" />
+ <!--TODO: https://jira.jboss.org/jira/browse/JBPM-2071 -->
+ <replace file="${project.output.dir}/jbpm.mysql.create.sql"
+ token="BLOB_VALUE_ blob"
+ value="BLOB_VALUE_ longblob" />
- <!-- PostgreSQL -->
- <create-ddl db="postgresql"/>
+ <!-- Oracle -->
+ <create-ddl db="oracle" />
- </target>
+ <!-- PostgreSQL -->
+ <create-ddl db="postgresql" />
- <!--
- ============================================
- Macro defs, no need to change anything below
- ============================================
- -->
+ </target>
- <macrodef name="create-ddl">
- <attribute name="db"/>
+ <!-- ============================================ -->
+ <!-- Macro definitions -->
+ <!-- ============================================ -->
- <sequential>
- <echo>=====================</echo>
- <echo>Create DDL @{db}</echo>
-
- <schemaexport output="${project.output.dir}/jbpm.@{db}.create.sql"
- create="yes" drop="no"
- config="src/main/config/@{db}.hibernate.cfg.xml"
- text="yes" delimiter=";"
- quiet="yes"/>
- <schemaexport output="${project.output.dir}/jbpm.@{db}.drop.sql"
- create="no" drop="yes"
- config="src/main/config/@{db}.hibernate.cfg.xml"
- text="yes" delimiter=";"
- quiet="yes"/>
+ <macrodef name="create-ddl">
+ <attribute name="db" />
- <echo>=====================</echo>
- </sequential>
- </macrodef>
+ <sequential>
+ <echo>=====================</echo>
+ <echo>Create DDL @{db}</echo>
+ <schemaexport output="${project.output.dir}/jbpm.@{db}.create.sql"
+ create="yes" drop="no"
+ config="src/main/config/@{db}.hibernate.cfg.xml"
+ text="yes" delimiter=";"
+ quiet="yes" />
+ <schemaexport output="${project.output.dir}/jbpm.@{db}.drop.sql"
+ create="no" drop="yes"
+ config="src/main/config/@{db}.hibernate.cfg.xml"
+ text="yes" delimiter=";"
+ quiet="yes" />
+
+ <echo>=====================</echo>
+ </sequential>
+ </macrodef>
+
</project>
Modified: jbpm4/trunk/modules/db/scripts/antrun-upgrade.xml
===================================================================
--- jbpm4/trunk/modules/db/scripts/antrun-upgrade.xml 2009-08-14 10:04:17 UTC (rev 5480)
+++ jbpm4/trunk/modules/db/scripts/antrun-upgrade.xml 2009-08-15 03:29:25 UTC (rev 5481)
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
-
<!-- ============================================ -->
<!-- jBPM database schema -->
<!-- ============================================ -->
@@ -9,21 +8,37 @@
<taskdef name="schemaupdate"
classname="org.hibernate.tool.hbm2ddl.SchemaUpdateTask"
classpathref="maven.compile.classpath" />
- <taskdef name="schemaexport"
- classname="org.hibernate.tool.hbm2ddl.SchemaExportTask"
- classpathref="maven.compile.classpath"/>
+ <taskdef name="schemaexport"
+ classname="org.hibernate.tool.hbm2ddl.SchemaExportTask"
+ classpathref="maven.compile.classpath" />
- <!-- HSQLDB -->
- <upgrade-ddl db="hsqldb"/>
+ <!-- HSQLDB -->
+ <java classname="org.hsqldb.Server"
+ classpathref="maven.compile.classpath"
+ fork="yes" spawn="yes">
+ <arg value="-port" />
+ <arg value="1701" />
+ <arg value="-database.0" />
+ <arg value="${previous.version.dir}/jbpmdb" />
+ </java>
+ <upgrade-ddl db="hsqldb" />
+ <sql url="${hsqldb.hibernate.connection.url}"
+ driver="${hsqldb.hibernate.connection.driver_class}"
+ classpathref="maven.compile.classpath"
+ userid="${hsqldb.hibernate.connection.username}"
+ password="${hsqldb.hibernate.connection.password}"
+ autocommit="yes">
+ SHUTDOWN
+ </sql>
- <!-- MySQL -->
- <upgrade-ddl db="mysql"/>
+ <!-- MySQL -->
+ <upgrade-ddl db="mysql" />
- <!-- Oracle -->
- <upgrade-ddl db="oracle"/>
+ <!-- PostgreSQL -->
+ <upgrade-ddl db="postgresql" />
- <!-- PostgreSQL -->
- <upgrade-ddl db="postgresql"/>
+ <!-- Oracle -->
+ <upgrade-ddl db="oracle" />
</target>
<!-- ============================================ -->
@@ -37,31 +52,40 @@
<echo>=====================</echo>
<echo>Upgrade DDL @{db}</echo>
- <property file="${user.home}/.jbpm4/jdbc/@{db}.properties" prefix="@{db}"/>
- <echo>driver... ${@{db}.jdbc.driver}</echo>
- <echo>url...... ${@{db}.jdbc.url}</echo>
- <echo>username. ${@{db}.jdbc.username}</echo>
- <echo>password. ${@{db}.jdbc.password}</echo>
+ <!-- calculate the difference beetween the previous and the current create schemas -->
+ <exec command="diff" osfamily="unix" output="${previous.version.dir}/jbpm.@{db}.create.diff">
+ <arg value="-u" />
+ <arg file="${previous.version.dir}/jbpm.@{db}.create.sql" />
+ <arg file="${project.output.dir}/jbpm.@{db}.create.sql" />
+ </exec>
+
+ <property name="@{db}.hibernate.cfg" value="src/main/config/@{db}.hibernate.cfg.xml" />
+ <property name="@{db}.hibernate.properties"
+ value="${user.home}/.jbpm4/jdbc/@{db}.properties" />
+ <property file="${@{db}.hibernate.properties}" prefix="@{db}" />
+ <echo>driver... ${@{db}.hibernate.connection.driver_class}</echo>
+ <echo>url...... ${@{db}.hibernate.connection.url}</echo>
+ <echo>username. ${@{db}.hibernate.connection.username}</echo>
+ <echo>password. ${@{db}.hibernate.connection.password}</echo>
+
<!-- drop current schema if exists -->
- <sql src="${project.output.dir}/jbpm.@{db}.drop.sql" url="${@{db}.jdbc.url}"
- driver="${@{db}.jdbc.driver}" classpathref="maven.compile.classpath"
- userid="${@{db}.jdbc.username}" password="${@{db}.jdbc.password}"
- autocommit="yes" onerror="continue"/>
+ <schemaexport output="${project.output.dir}/jbpm.@{db}.drop.sql"
+ config="${@{db}.hibernate.cfg}"
+ properties="${@{db}.hibernate.properties}"
+ drop="yes" quiet="yes" />
<!-- create previous version schema -->
- <sql src="${previous.version.dir}/jbpm.@{db}.create.sql" url="${@{db}.jdbc.url}"
- driver="${@{db}.jdbc.driver}" classpathref="maven.compile.classpath"
- userid="${@{db}.jdbc.username}" password="${@{db}.jdbc.password}"
- autocommit="yes"/>
+ <sql src="${previous.version.dir}/jbpm.@{db}.create.sql"
+ url="${@{db}.hibernate.connection.url}"
+ driver="${@{db}.hibernate.connection.driver_class}"
+ classpathref="maven.compile.classpath"
+ userid="${@{db}.hibernate.connection.username}"
+ password="${@{db}.hibernate.connection.password}"
+ autocommit="yes" continue="yes" />
<!-- generate schema upgrade script -->
- <schemaupdate outputFile="${project.build.dir}/jbpm.@{db}.update.sql"
- config="src/main/config/@{db}.hibernate.cfg.xml"
- properties="${user.home}/.jbpm4/@{db}.properties"
- text="yes" delimiter=";"/>
- <!-- drop previous version schema -->
- <sql src="${previous.version.dir}/jbpm.@{db}.drop.sql" url="${@{db}.jdbc.url}"
- driver="${@{db}.jdbc.driver}" classpathref="maven.compile.classpath"
- userid="${@{db}.jdbc.username}" password="${@{db}.jdbc.password}"
- autocommit="yes"/>
+ <schemaupdate outputFile="${previous.version.dir}/jbpm.@{db}.update.sql"
+ config="${@{db}.hibernate.cfg}"
+ properties="${@{db}.hibernate.properties}"
+ delimiter=";" />
<echo>=====================</echo>
</sequential>
More information about the jbpm-commits
mailing list