title: Flyway migration fails due to Unique index or primary key violation
body: <p>I'm starting to use flyway in my spring managed java project (I'm using also hibernate).</p>
  
  <p>I followed the documentation of flyway.I configured also maven plugin and all works fine.</p>
  
  <p>Trying to use maven plugin to do clean,init and migrate, all works fine.</p>
  
  <p>Instead if I try to run my application (in which I've my flyway bean):</p>
  
  <pre><code>&lt;bean id="flyway" class="org.flywaydb.core.Flyway" init-method="migrate"&gt;
      &lt;property name="dataSource" ref="dataSource" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>I see that:</p>
  
  <ul>
  <li>the schema of the db is created</li>
  <li>the schema_version table is created</li>
  <li>my script to create the entire db works</li>
  </ul>
  
  <p>Unfortunally my app can't start due to an error during the migration that I don't understand:</p>
  
  <pre><code>    31/10/2014 11:03:34  INFO DbSupportFactory:43 - Database: jdbc:h2:~/db/db (H2 1.4)
  31/10/2014 11:03:34  INFO DbValidate:43 - Validated 1 migration (execution time 00:00.015s)
  31/10/2014 11:03:34  INFO MetaDataTableImpl:43 - Creating Metadata table: "PUBLIC"."schema_version"
  31/10/2014 11:03:34  INFO DbMigrate:43 - Current version of schema "PUBLIC": &lt;&lt; Empty Schema &gt;&gt;
  31/10/2014 11:03:34  INFO DbMigrate:43 - Migrating schema "PUBLIC" to version 3.0.0
  31/10/2014 11:03:34 ERROR ContextLoader:331 - Context initialization failed
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flyway' defined in ServletContext resource [/WEB-INF/spring/app-jpa-config.xml]: Invocation of init method failed; nested exception is org.flywaydb.core.api.FlywayException: Unable to insert row for version '3.0.0' in metadata table "PUBLIC"."schema_version"
  ...
  ...
  ...
  Caused by: org.h2.jdbc.JdbcSQLException: Unique index or primary key violation: "PRIMARY_KEY_6 ON PUBLIC.""schema_version""(""version"") VALUES ( /* 3 */ CAST('3.0.0' AS VARCHAR_IGNORECASE) )"; SQL statement:
  INSERT INTO "PUBLIC"."schema_version" ("version_rank","installed_rank","version","description","type","script","checksum","installed_by","execution_time","success") VALUES (?, ?, ?, ?, ?, ?, ?, USER(), ?, ?) [23505-182]
  </code></pre>
  
  <p>So seems a duplicate exception but it is very strange. After this I seen the db and always seems correct:</p>
  
  <ul>
  <li>schema_versione contains two row: flyway init and my script that has version 3.0.0</li>
  <li>I see that the entire db is created</li>
  </ul>
  
  <p>So my question is: what is wrong? Is flyway trying to make the migration twice?</p>
  
  <p>Thanks</p>