FlywayException: Found non-empty schema(s) “public” but no schema history table. Use baseline() or set baselineOnMigrate to true to initialize the schema history table.

Java

Flywayを初めて実行するときにスキーマ内が空でないと例外を出力して処理を中断します。既存のデータベースを誤って破壊してしまわないように考慮されているようです。

baselineを設定する

ベースラインを設定すると実行できます。

# application.yaml
spring:
  flyway:
    baseline-on-migrate: true

flyway.baselineOnMigrate – Baseline On Migrate – Flyway by Redgate • Database Migrations Made Easy.

コメント

タイトルとURLをコピーしました