From the course: Extending, Securing, and Dockerizing Spring Boot Microservices

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Database migration with Flyway

Database migration with Flyway

From the course: Extending, Securing, and Dockerizing Spring Boot Microservices

Start my 1-month free trial

Database migration with Flyway

- [Instructor] Schema.SQL and data.SQL are good for initialization. But, real world databases change over time. Flyway is a database migration tool that controls triggering of version database migration scripts. So, let's add it to our application. So, I have it already in the pom.xml. There's the dependency, org.flywaydd. With the artifactID, flyway-core. And if you look at the resources folder, the data.SQL and schema.SQL are gone. And there's a new folder called db/migration. And what these files are, they are scripts that are taken from the schema and data files and they've been broken up into a series of versioned db scripts. And the order is defined by the version number prefix of the file. Flyway will know if a script is already been run on the database. So, there is no need for the spring.datasource.continueonerror setting in applications.property. So before we try it, we wanna make sure that the database container does not already exist and remove it if it is. So, the…

Contents