Reputation:
In a Java app, I have a model class and I want to generate Flyway migration script from it. There is a useful plugin called JPABuddy, but I unable to generate migration script using the same (it only detects the index part even when I delete the corresponding table). So, how can I generate migration script in IntelliJ IDEA?
Upvotes: 1
Views: 3428
Reputation: 148
I think in order for Flyway to work you need to have a base database schema. After which you could add other schema changes.
I think the best way forward for you here would be to create a DB schema using JPA by adding below properties in properties file.
spring.jpa.properties.javax.persistence.schema-generation.scripts.action=create
spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=create.sql
spring.jpa.properties.javax.persistence.schema-generation.scripts.create-source=metadata
Then you can use the create.sql as the base DB schema for Flyway migration.
Upvotes: 3