<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Carbon Emitter &#187; maven</title>
	<atom:link href="http://blog.carbonfive.com/tag/maven/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.carbonfive.com</link>
	<description>The blog of Carbon Five</description>
	<lastBuildDate>Mon, 23 Jan 2012 18:38:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Database Migrations: Fail when database is out of date</title>
		<link>http://blog.carbonfive.com/2010/01/20/database-migrations-fail-when-database-is-out-of-date/</link>
		<comments>http://blog.carbonfive.com/2010/01/20/database-migrations-fail-when-database-is-out-of-date/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 22:41:15 +0000</pubDate>
		<dc:creator>Christian Nelson</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://blog.carbonfive.com/?p=811</guid>
		<description><![CDATA[The latest release of the Carbon Five Database Migration maven plugin supports a new goal: check. The check goal fails the build if the database isn&#8217;t up to date. That is, if there are pending migrations the plugin produces a &#8230; <a href="http://blog.carbonfive.com/2010/01/20/database-migrations-fail-when-database-is-out-of-date/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The latest release of the <a href="http://code.google.com/p/c5-db-migration/">Carbon Five Database Migration maven plugin</a> supports a new goal: check.  The check goal fails the build if the database isn&#8217;t up to date.  That is, if there are pending migrations the plugin produces a clear message explaining that the database is out of date and lists the pending migrations.  Run <code>mvn test</code> and see something like this:</p>
<p>[INFO] &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
[INFO] Building Gearlist &#8211; Data Access<br />
[INFO]    task-segment: [test]<br />
[INFO] &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
[INFO] [db-migration:check {execution: default}]<br />
[INFO] Checking jdbc:mysql://localhost/gearlist_test using migrations at src/main/db/migrations/.<br />
[INFO] Loaded JDBC driver: com.mysql.jdbc.Driver<br />
[WARNING] There are 2 pending migrations:</p>
<p>    20100116010256_audit_tracking.sql<br />
    20100121052539_add_daily_reports.sql</p>
<p>    Execute db-migration:migrate to apply pending migrations.<br />
[INFO] &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
[ERROR] BUILD ERROR<br />
[INFO] &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
[INFO] There are 2 pending migrations, migrate your db and try again.</p>
<p>It&#8217;s very easy to include the check goal in your build lifecycle if you&#8217;re already using the db-migration-maven-plugin.</p>
<pre class="brush: xml; light: true; title: ; wrap-lines: false; notranslate">
...
&amp;lt;build&amp;gt;
    &amp;lt;plugins&amp;gt;
        &amp;lt;plugin&amp;gt;
            &amp;lt;groupId&amp;gt;com.carbonfive.db-support&amp;lt;/groupId&amp;gt;
            &amp;lt;artifactId&amp;gt;db-migration-maven-plugin&amp;lt;/artifactId&amp;gt;
            &amp;lt;version&amp;gt;0.9.9-m2&amp;lt;/version&amp;gt;
            &amp;lt;executions&amp;gt;
                &amp;lt;execution&amp;gt;
                    &amp;lt;phase&amp;gt;validate&amp;lt;/phase&amp;gt;
                    &amp;lt;goals&amp;gt;
                        &amp;lt;goal&amp;gt;check&amp;lt;/goal&amp;gt;
                    &amp;lt;/goals&amp;gt;
                &amp;lt;/execution&amp;gt;
            &amp;lt;/executions&amp;gt;
            &amp;lt;configuration&amp;gt;
                &amp;lt;url&amp;gt;jdbc:mysql://${db.host}/${db.name}&amp;lt;/url&amp;gt;
                &amp;lt;username&amp;gt;${db.username}&amp;lt;/username&amp;gt;
                &amp;lt;password&amp;gt;${db.password}&amp;lt;/password&amp;gt;
            &amp;lt;/configuration&amp;gt;
        &amp;lt;/plugin&amp;gt;
    &amp;lt;/plugins&amp;gt;
&amp;lt;/build&amp;gt;
</pre>
<p>Check out the <a href="http://code.google.com/p/c5-db-migration/">project home</a> for additional documentation and details.  There&#8217;s also a simple, complete <a href="http://svn.carbonfive.com/public/christian/migration-sample1/trunk/">example application</a> showing off this configuration.</p>
<p>Enjoy!<br />
Christian</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.carbonfive.com/2010/01/20/database-migrations-fail-when-database-is-out-of-date/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

