title: How can i use Flyway migration with single schema and multiple projects
body: <p>How to manage multiple projects dealing with the same DB schema. The Flyway migration scripts in each of the project does not allow to start if it is modified by the other project.</p>
  
  <p>For example: </p>
  
  <p>I have a spring boot Project X with a FlywayInitializer class. </p>
  
  <pre><code>   @PostConstruct
      public void migrateFlyway() {
          final Flyway flyway = new Flyway();
  
          flyway.setSchemas("schema1");
          flyway.setLocations("classpath:x.migration");
          flyway.migrate();
      }
  </code></pre>
  
  <p>And i have a submodule Project Y with also his own FlywayInitializer class</p>
  
  <pre><code>   @PostConstruct
      public void migrateFlyway() {
          final Flyway flyway = new Flyway();
  
          flyway.setSchemas("schema1");
          flyway.setLocations("classpath:y.migration");
          flyway.migrate();
      }
  </code></pre>
  
  <p>Project Structure:</p>
  
  <pre><code>Project X
      src
        |
        main
            |
             java 
                  FlywayInitializerX.java 
            |
             resources
                 V1.0_create_tableX.sql
                 V1.1_update_tableX.sql 
  
  Project Y 
      src
        |
        main
            |
             java 
                  FlywayInitializerY.java 
            |
              resources
                 V1.0_create_tableY.sql 
                 V1.1_update_tableY.sql 
  </code></pre>
  
  <p>How can i use the for both Project X and Y the same schemaname "schema1" with Flyway ? </p>
  
  <hr>
  
  <p><strong>EDIT:</strong>
  Thanks @jesper_bk that helped me. Its exactly what i wanted, that the two projects have completely "independent lives" in the same schema. But now i have the following problem: </p>
  
  <p>The first executed project X create tables correcty, but if Project Y is started i get the error <strong>Found non-empty schema without metadata table</strong>. So i have to set BaselineOnMigrate to true. But if i set BaselineOnMigrate to true the Project Y skip the sql file <strong>V1.0_create_tableY.sql</strong> and starts with <strong>V1.1_update_tableY.sql</strong>. How can i reach, that the first sql script V1.0_create_tableY.sql is also executed for Project Y? </p>
  
  <pre><code> @PostConstruct
      public void migrateFlyway() {
          final Flyway flyway = new Flyway();
  
          flyway.setBaselineVersionAsString("1");
          flyway.setBaselineOnMigrate(true);
  
          flyway.setSchemas("schema1");
          flyway.setLocations("classpath:y.migration");
          flyway.migrate();
  
      }
  </code></pre>