2
respuestas

Error al ejecutar el segundo script para crear una columna phone y ahora ya no inicia el proyecto.


2023-09-28T19:52:55.661-05:00  INFO 1604 --- [  restartedMain] o.f.c.internal.license.VersionPrinter    : Flyway Community Edition 9.22.1 by Redgate
2023-09-28T19:52:55.661-05:00  INFO 1604 --- [  restartedMain] o.f.c.internal.license.VersionPrinter    : See release notes here: https://rd.gt/416ObMi
2023-09-28T19:52:55.661-05:00  INFO 1604 --- [  restartedMain] o.f.c.internal.license.VersionPrinter    : 
2023-09-28T19:52:55.732-05:00  INFO 1604 --- [  restartedMain] org.flywaydb.core.FlywayExecutor         : Database: jdbc:mysql://localhost/vollmed_api (MySQL 8.0)
2023-09-28T19:52:55.882-05:00  WARN 1604 --- [  restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: 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
Detected failed migration to version 1 (create-table-doctors).
Please remove any half-completed changes then run repair to fix the schema history.
Need more flexibility with validation rules? Learn more: https://rd.gt/3AbJUZE
2023-09-28T19:52:55.883-05:00  INFO 1604 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
2023-09-28T19:52:55.921-05:00  INFO 1604 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.
2023-09-28T19:52:55.926-05:00  INFO 1604 --- [  restartedMain] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2023-09-28T19:52:55.952-05:00  INFO 1604 --- [  restartedMain] .s.b.a.l.ConditionEvaluationReportLogger : 

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2023-09-28T19:52:56.006-05:00 ERROR 1604 --- [  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
Detected failed migration to version 1 (create-table-doctors).
Please remove any half-completed changes then run repair to fix the schema history.
Need more flexibility with validation rules? Learn more: https://rd.gt/3AbJUZE
Caused by: org.flywaydb.core.api.exception.FlywayValidateException: Validate failed: Migrations have failed validation
Detected failed migration to version 1 (create-table-doctors).
Please remove any half-completed changes then run repair to fix the schema history.
Need more flexibility with validation rules? Learn more: https://rd.gt/3AbJUZE
2 respuestas

[SOLUCIÓN]

Error: Si hiciste un script para alterar una base de datos mientras tenías el servidor ejecutándose. Solución: ejecutar el comando delete from flyway_schema_history where success = 0; Elimina los registros de la tabla flyway_schema_history donde success sea 0.

Hola Jean,

Sí, genial y gracias por compartir con nosotros. El error dice que detectó una migración fallida a la versión 1. Flyway maneja la versión de la base de datos y si se encuentra con un error durante una migración, no permitirá que ninguna otra migración se aplique hasta que se resuelva el problema.

Mucho éxito en todo lo que te propongas y si tienes alguna duda aquí estaremos para apoyarte.

¡Vamos juntos!

Si este post te ayudó, por favor, marca como solucionado ✓. Continúa con tus estudios