flyway checksum error / how to recover / spring / java
flywayMigrate 를 해서 checksum error 가 나온 경우
gradle flywayMigrate
를 이용해서 migration 을
실행했는데, checksum 이 달라서 error 가 났다. 이 checksum 은 db 내
flyway_schema_history table 에서 확인할 수 있다. 이 table 에 checksum
column 을 보면, 각 script 에 대한 checksum 으로 보이는 값들이 들어가
있다.
gradlew -Dflyway.configFiles=./conf/flyway.testdb.conf flywayMigrate
- flyway - The meaning of the concept of checksums - Stack Overflow : flyway checksum code 를 확인할 수 있다.
이 checksum 값이 달라졌을 때 현재값으로 수정하려면,
gradlew flywayRepair
를 하면 된다.
실행 내용
D:\a\prog\myproj>gradlew -Dflyway.configFiles=./conf/flyway.testdb.conf flywayMigrate
Configuration on demand is an incubating feature.
> Task :flywayMigrate FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':flywayMigrate'.
> Error occurred while executing flywayMigrate
Validate failed: Migrations have failed validation
Migration checksum mismatch for migration version 1.0.13
-> Applied to database : -797331436
-> Resolved locally : 1114727104
Either revert the changes to the migration, or run repair to update the schema history.
Need more flexibility with validation rules? Learn more: https://rd.gt/3AbJUZE
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
1 actionable task: 1 executed
D:\a\prog\myproj>gradlew -Dflyway.configFiles=./conf/flyway.testdb.conf flyway
Configuration on demand is an incubating feature.
FAILURE: Build failed with an exception.
* What went wrong:
Task 'flyway' is ambiguous in root project 'pa'. Candidates are: 'flywayBaseline', 'flywayClean', 'flywayInfo', 'flywayMigrate', 'flywayRepair', 'flywayUndo', 'flywayValidate'.
* Try:
Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 656ms
D:\a\prog\myproj>gradlew -Dflyway.configFiles=./conf/flyway.testdb.conf flywayRepair
Configuration on demand is an incubating feature.
BUILD SUCCESSFUL in 1s
1 actionable task: 1 executed
D:\a\prog\myproj>gradlew -Dflyway.configFiles=./conf/flyway.testdb.conf flywayMigrate
Configuration on demand is an incubating feature.
BUILD SUCCESSFUL in 2s
1 actionable task: 1 executed
D:\a\prog\myproj>
댓글 없음:
댓글 쓰기