Eclipse上でFlywayを追加・設定・実行


 EclipseプロジェクトにFlywayを追加・設定・実行までの手順

今回はmavenプロジェクトでflywayを追加などを説明

追加手順

pom.xmlにFlywayのdependencyを追加する

    <dependency>
        <groupId>org.flywaydb</groupId>
        <artifactId>flyway-core</artifactId>
    </dependency>

接続設定

pom.xmlに

project > build > plugins の中にpluginを追加

        <plugin>
            <groupId>org.flywaydb</groupId>
            <artifactId>flyway-maven-plugin</artifactId>
            <configuration>
                <user>user<user>
                <password>password</password>
                <url>jdbc:mysql://localhost:3306/databaseName?serverTimezone=UTC</url>
                <schemas>
                    <schema>schemaName</schema>
                </schemas>
            </configuration>
        </plugin>

実行

プロジェクトのrootフォルダーの中に「shift+MR」(shift + 右クリック)で「powershell。。。」をクリック

PowerShellを開いた後以下のコードを実行

./mvnw clean flyway:migrate