Beginning Spring Data by 2023

Beginning Spring Data by 2023

Author:2023
Language: eng
Format: epub


Chapter 6 Versioning or Migrating Changes

2022-07-08 01:07:52.093 INFO 354638 --- [ restartedMain] liquibase.

lockservice : Successfully acquired change log lock

Flyway

This tool mostly follows the same steps as before, but the configuration in Spring Boot

may be simpler, depending on the approach that you want to use. Flyway has various

ways to execute a migration.

• It includes only the dependency in the pom file so that when the

application starts up, it executes all the scripts and validates the

consistency of the database.

• It includes a plugin in the pom file and executes a command in the

same way you use the CLI interface.

To reduce the complexity, use the first option, which implies that you only include

the dependency and delegates the responsibility to execute the command to Spring

Boot. Let’s add the dependency that appears in Listing 6-6.

Listing 6-6. Flyway Dependencies

<dependencies>

<dependency>

<groupId>org.flywaydb</groupId>

<artifactId>flyway-core</artifactId>

</dependency>

← Other dependencies –>

</dependencies>

After that, create a new folder in src/main/resources/db/migration and paste the

SQL files that you used in the previous chapter inside the folder. The structure will have an aspect like Figure 6-5.

175



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.