Doctrine Migrations and Jenkins

If you’re trying to automate Symfony2/Doctrine2 migrations with Jenkins, you may run afoul of the interactive confirmation that the doctrine-migrations package throws out:

$ app/console doctrine:migrations:migrate

Application Migrations

WARNING! You are about to execute a database migration that could result in schema changes and data lost. Are you sure you wish to continue? (y/n)

This will break the Jenkins build. While there is probably a way to get Jenkins to reply to this with a “y”, it’s easier just to use the under documented --no-interaction switch. In a build.xml for example:

<target name="schema" description="Update database">
<exec executable="app/console" failonerror="true">
<arg line="doctrine:migrations:migrate --no-interaction" />

Now if the migrations work, so does the build.

One thought on “Doctrine Migrations and Jenkins

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.