Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flyway with Spring: Can I have SQL and Java based migrations?

Tags:

spring

flyway

Is it possible to have both SQL and Java based migrations? (ie: an .sql file and .java file)? If so, do they rest in the same directory?

like image 727
kot09 Avatar asked Sep 29 '16 14:09

kot09


1 Answers

Do you mean with spring-boot? Please clarify what context Spring has in this question and I'll update my answer.

Aside from Spring, SQL and Java migrations are both available to you in combination. You can configure the location of your migration files, see the locations section of migrate but by default your SQL and Java migration files will be found in db/migration on the classpath. So in a typical project that would be

src/main
└── java
    └── db
        └── migration
            ├── V3__M3.java
            └── V4__M4.java

└── resources
    └── db
        └── migration
            ├── V1__m1.sql
            └── V2__m2.sql
like image 74
markdsievers Avatar answered Sep 20 '22 07:09

markdsievers