From the course: Extending, Securing, and Dockerizing Spring Boot Microservices
Unlock the full course today
Join today to access over 23,300 courses taught by industry experts.
Database migration with Flyway
From the course: Extending, Securing, and Dockerizing Spring Boot Microservices
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.