This is a skeleton repository to start developing a database with MySQL.
You need to be able to use "docker-compose".
- Docker Engine: 19.03.0 or above
- Type the following command in the project root directory to start the container.
docker-compose up -d
- Enter the following command to enter the migrate container.
docker-compose exec migrate bash
- In the migrate container, use the gradle wrapper to run the flyway task with a command like the following.
- Create a baseline in the target database. (First time only).
./gradlew flywayBaseline
- Build the migrate file.
./gradlew build
- Check the status information of the migration.
./gradlew flywayInfo
- Execute the migration.
./gradlew flywayMigrate
- Create a baseline in the target database. (First time only).
You can set multiple database connection information in "gradle.properties"
.
The connection information defined here is used by specifying the environment name in the project property "env"
when executing the gradle command as shown below. (Defaults to "local"
if not set.)
(Example)
[gradle.properties]
develop.flyway.url = jdbc:mysql://xxx.xxx.xxx.xxx:3306/develop_db
develop.flyway.user = flyway
develop.flyway.password = password
[command]
./gradlew flywayMigrate -Penv=develop