Flyway Migrations
In this blog we’re going to create Flyway migrations in IntelliJ Idea IDE. In first open JPA Structure window. Click to plus icon and select Diff Versioned Migrations menu.
Then opening a window which title is Flyway Diff Versioned Migrations. In left side you can see Source section. Model option must be selected in here. In right side you can see Target section. You must select DB option. After that click to OK button.
After that you can see SQL codes which detected difference between your Model and DB. Click to OK in here.
In Project window you can see created sql files like that:
So how to run migrations? You don’t need it. Because when you start your app Flyway is automatically running migrations. You just simply start your Spring Boot app like that:
./gradlew bootRun
After that you can see executed migrations in your database: your_db.flyway_schema_history
That’s all. You just create your JPA Models and then create migrations like this.
Happy coding…
0 yorum