LoginSignup
4
5

More than 5 years have passed since last update.

flywayでDBマイグレーションする時、baselineがない!と怒られる時

Posted at
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':flywayMigrate'.
> Error occurred while executing flywayMigrate
  Found non-empty schema `hogehoge` without metadata table! Use baseline() or set baselineOnMigrate to true to initialize the metadata table.

初めてflywayでDBマイグレーションする時や、DBに存在するすべてのテーブルをdropした後再度flywayを使うとき、上記のようなエラーが出る。
マイグレーション管理用テーブルが存在していないことが原因。
これを生成するには、

gradle flywayBaseline -i 

上記コマンドを使う。

参考:
* FlywayでDBスキーマのマイグレーションをしてみた | Siguniang's Blog
* Command-line: baseline - Documentation - Flyway by Boxfuse • Database Migrations Made Easy.

4
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
5