Caused by: org.flywaydb.core.api.FlywayException: Validate failed: Detected failed migration to version 2.35.4 (Remove color set)
this is what I suppose the script running
Since some tables were dropped, I deduced it’s the color table causing the issue
I ran manually in psql the following command : drop table if exists color;
The command outputs this :
ERROR: cannot drop table color because other objects depend on it
DETAIL: constraint fk_objecttranslation_colorid on table colortranslations depends on table color
The thing I don’t understand all these tables are empty
dhis2=> select * from colortranslations;
colorid | objecttranslationid
---------+---------------------
(0 rows)
dhis2=> select * from color;
colorid | uid | code | created | lastupdated | lastupdatedby | color | name | translations
---------+-----+------+---------+-------------+---------------+-------+------+--------------
(0 rows)
I assume the migration that drops the table “forgot” about colortranslations
Restarted the server but the migration still fails
drop table if exists colorset;
ERROR: cannot drop table colorset because other objects depend on it
DETAIL: constraint fk_objecttranslation_colorsetid on table colorsettranslations depends on table colorset
HINT: Use DROP ... CASCADE to drop the dependent objects too.
so I dropped also colorsettranslations
Restarted the server but the migration still fails…
Is there something to tell to flyway to relaunch the migration ?
delete from flyway_schema_history where flyway_schema_history.success = false
now the server starts
* INFO 2020-11-10T13:01:40,066 Executing startup routine [6 of 10, runlevel 11]: ExpressionUpgrader (DefaultStartupRoutineExecutor.java [localhost-startStop-1])
* ERROR 2020-11-10T13:01:40,184 Upgrading custom data entry form failed: S KPI - Initiation (ExpressionUpgrader.java [localhost-startStop-1])
java.lang.NumberFormatException: For input string: "ElNWXB4odHy"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) ~[?:1.8.0_272]
at java.lang.Integer.parseInt(Integer.java:580) ~[?:1.8.0_272]
at java.lang.Integer.parseInt(Integer.java:615) ~[?:1.8.0_272]
at org.hisp.dhis.startup.ExpressionUpgrader.upgradeDataEntryForms(ExpressionUpgrader.java:232) [dhis-service-core-2.35.0.jar:?]
at org.hisp.dhis.startup.ExpressionUpgrader.executeInTransaction(ExpressionUpgrader.java:107) [dhis-service-core-2.35.0.jar:?]
at org.hisp.dhis.system.startup.TransactionContextStartupRoutine$1.doInTransaction(TransactionContextStartupRoutine.java:58) [dhis-support-system-2.35.0.jar:?]
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140) [spring-tx-5.2.8.RELEASE.jar:5.2.8.RELEASE]
at org.hisp.dhis.system.startup.TransactionContextStartupRoutine.execute(TransactionContextStartupRoutine.java:53) [dhis-support-system-2.35.0.jar:?]
at org.hisp.dhis.system.startup.DefaultStartupRoutineExecutor.execute(DefaultStartupRoutineExecutor.java:114) [dhis-support-system-2.35.0.jar:?]
at org.hisp.dhis.system.startup.DefaultStartupRoutineExecutor.execute(DefaultStartupRoutineExecutor.java:71) [dhis-support-system-2.35.0.jar:?]
at org.hisp.dhis.system.startup.StartupListener.contextInitialized(StartupListener.java:70) [dhis-support-system-2.35.0.jar:?]
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4697) [webapp-runner.jar:?]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5165) [webapp-runner.jar:?]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [webapp-runner.jar:?]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1412) [webapp-runner.jar:?]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1402) [webapp-runner.jar:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_272]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_272]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_272]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_272]
so I assume some custom data entry won’t work as expected
Hope it’s not too late but the solution to this problem as Oslo fix this issue, delete all version 2.5xx in the flyway_history table and drop every column flyway has added to the tables. This worked.