title: FlywayDB: Migration fails with "Error executing statement", but manually running migration SQL code works
body: <p>I have a play framework 2.2.2 scala application and use play-flyway 1.0.3.</p>
  
  <p>The following migration should be run by flyway:</p>
  
  <pre><code>ALTER TABLE  `user_visits` ADD  `FirstSiteRequestTime` DATETIME NOT NULL ;
  UPDATE `user_visits` SET `FirstSiteRequestTime`=(SELECT `Time` FROM `user_siterequests` WHERE `user_siterequests`.`Visit`=`user_visits`.`ID` ORDER BY `Time` ASC LIMIT 1) ;
  </code></pre>
  
  <p>So I add a column to a table and then programatically fill it using an update statement.</p>
  
  <p>The first line executes fine, but the update statemens fails with</p>
  
  <pre><code>FlywaySqlScriptException: Error executing statement at line 2: UPDATE `user_visits` SET `FirstSiteRequestTime`=(SELECT `Time` FROM `user_siterequests` WHERE `user_siterequests`.`Visit`=`user_visits`.`ID` ORDER BY `Time` ASC LIMIT 1)
  com.googlecode.flyway.core.command.FlywaySqlScriptException: Error executing statement at line 2: UPDATE `user_visits` SET `FirstSiteRequestTime`=(SELECT `Time` FROM `user_siterequests` WHERE `user_siterequests`.`Visit`=`user_visits`.`ID` ORDER BY `Time` ASC LIMIT 1)
  com.googlecode.flyway.core.dbsupport.SqlScript.execute(SqlScript.java:92)
  com.googlecode.flyway.core.resolver.sql.SqlMigrationExecutor.execute(SqlMigrationExecutor.java:72)
  com.googlecode.flyway.core.command.DbMigrate$2.doInTransaction(DbMigrate.java:243)
  com.googlecode.flyway.core.command.DbMigrate$2.doInTransaction(DbMigrate.java:241)
  com.googlecode.flyway.core.util.jdbc.TransactionTemplate.execute(TransactionTemplate.java:72)
  </code></pre>
  
  <p>However, when I take the migration SQL code and run it using phpmyadmin, it works fine (although it takes 2-5 seconds to run, the tables are quite big).</p>
  
  <p>My mysql.log looks like</p>
  
  <pre><code>                  128 Query SET autocommit=0
                    128 Query ALTER TABLE  `user_visits` ADD  `FirstSiteRequestTime` DATETIME NOT NULL
  140412  4:40:43   128 Query UPDATE `user_visits` SET `FirstSiteRequestTime`=(SELECT `Time` FROM `user_siterequests` WHERE `user_siterequests`.`Visit`=`user_visits`.`ID` ORDER BY `Time` ASC LIMIT 1)
  140412  4:40:44   128 Query rollback
                    128 Query SET autocommit=1
  </code></pre>
  
  <p>Is flyway having some kind of timeout? The log file shows it sends the query to the mysql server but then rolls back. Why? As stated before, the query is correct. It works when I run it manually.</p>
  
  <p><strong>edit</strong>:</p>
  
  <p>After running the migration, the ALTER TABLE statement was executed and committed (the table is altered), although the mysql.log says it was rolled back. The second command was really rolled back.</p>
  
  <p>I also tried splitting the two SQL commands in two migrations. Then the first one (ALTER TABLE) runs fine and the second one fails.</p>
  
  <p><strong>edit2</strong>:</p>
  
  <p>It might be some kind of timeout problem. Making it execute faster (by only updating some of the rows)</p>
  
  <pre><code>ALTER TABLE  `user_visits` ADD  `FirstSiteRequestTime` DATETIME NOT NULL ;
  UPDATE `user_visits` SET `FirstSiteRequestTime`=(SELECT `Time` FROM `user_siterequests` WHERE `user_siterequests`.`Visit`=`user_visits`.`ID` ORDER BY `Time` ASC LIMIT 1) WHERE user_visits.id&lt;1000;
  </code></pre>
  
  <p>runs correctly, also in flyway.</p>