title: Flyway "migrate" command can't find current schema (SQL Server)
body: <p>I just upgraded to version 2.1.1, and now I'm seeing a strange error - the migrate command fails with a Flyway exception when I run it against a database on our staging and production database servers, but it works fine against our development server.</p>
  
  <p>This is the debug output when it fails:</p>
  
  <pre><code>DEBUG: Adding location to classpath: C:\workspace\flyway\bin\..\jars\jtds-1.2.7.jar
  DEBUG: Database: Microsoft SQL Server 10.0
  DEBUG: DDL Transactions Supported: true
  DEBUG: Schema: dbo
  DEBUG: Schema [dbo] already exists. Skipping schema creation.
  DEBUG: No upgrade to the Flyway 2.0 format necessary for metadata table [dbo].[schema_version]
  DEBUG: No metadata table upgrade to the Flyway 2.0.2 format necessary
  DEBUG: No metadata table upgrade to the Flyway 2.1 format necessary
  ERROR: Unexpected error
  com.googlecode.flyway.core.api.FlywayException: Current schema not set for connection! Check your database configuration!
          at com.googlecode.flyway.core.dbsupport.DbSupport.getCurrentSchema(DbSupport.java:79)
          at com.googlecode.flyway.core.Flyway$1.execute(Flyway.java:855)
          at com.googlecode.flyway.core.Flyway$1.execute(Flyway.java:815)
          at com.googlecode.flyway.core.Flyway.execute(Flyway.java:1177)
          at com.googlecode.flyway.core.Flyway.migrate(Flyway.java:815)
          at com.googlecode.flyway.commandline.Main.executeOperation(Main.java:118)
          at com.googlecode.flyway.commandline.Main.main(Main.java:86)
  </code></pre>
  
  <p>It's clearly finding the schema when checking the metadata table, but then for some reason doesn't believe it's set later on.</p>
  
  <p>The schema itself is defined in the flyway.properties file -</p>
  
  <pre><code>flyway.schemas=dbo
  </code></pre>
  
  <p>I can't find any differences between dev and staging/prod that would cause this error.</p>
  
  <p>If it makes a difference, this is happening after a "clean" and "init"...  </p>
  
  <p>Any suggestions for where to look?</p>
  
  <p><strong>EDIT (for future people with the same issue):</strong>  Axel was correct about the login not having a default schema on the servers exhibiting the problem.  When I run </p>
  
  <pre><code>SELECT SCHEMA_NAME()
  </code></pre>
  
  <p>on our DEV server, I get "dbo" back; but when I run that on our ACC And PROD servers, I just get "NULL" back.</p>