Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Java | Spring Boot | Flyway | Falha ao executar migration

Estou trabalhando em um projeto com Java e Spring Boot seguindo as orientações do curso e acabei cometendo um erro mencionado em aula: cometi um erro na query SQL de uma migration e, após já tê-la executado, tentei alterá-la. A partir de então, passei a receber a exception: "Migration checksum mismatch for migration version 1".

O problema mesmo é que já tive várias tentativas de solucionar esse erro. Já apaguei o database e o criei novamente, já rodei os comandos "delete from flyway_schema_history where success = 0;" e "delete from flyway_schema_history;" (quando o rodo, recebo uma mensagem dizendo que essa tabela não existe), já apaguei a migration e a criei novamente, já criei outra migration e outro database com outros nomes. Nada disso funcionou e o erro persiste.

Sendo assim, como mais eu poderia resolver essa questão?

Envio o erro completo a seguir:

Migration checksum mismatch for migration version 1
-> Applied to database : -1797926061
-> Resolved locally    : -970528608
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
2023-08-28T18:54:20.885-03:00  INFO 17788 --- [  restartedMain] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2023-08-28T18:54:20.899-03:00  INFO 17788 --- [  restartedMain] .s.b.a.l.ConditionEvaluationReportLogger : 

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2023-08-28T18:54:20.913-03:00 ERROR 17788 --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Validate failed: Migrations have failed validation
Migration checksum mismatch for migration version 1
-> Applied to database : -1797926061
-> Resolved locally    : -970528608
Either revert the changes to the migration, or run repair to update the schema history.

Obrigado!

1 resposta
solução!

Postei essa dúvida no fórum do curso correto. Ela pode ser encontrada no seguinte link: https://cursos.alura.com.br/forum/topico-bug-java-spring-boot-flyway-falha-ao-executar-migration-319801

Sendo assim, acredito que podemos encerrar o presente post, visto que está duplicado.