Caused by: org.flywaydb.core.api.FlywayException: Validate failed:
May 30 20:11:03 dhis tomcat9[300]: Detected failed migration to version 2.34.8 (Create Audit Table). Please remove any half-completed changes then run repair to fix the schema history.
I don’t know exactly with which version of dhis 2 the backup was made. As mentioned in the error message, I tried all versions of 2.34.* and also 2.36, but I still have the same error.
To guess the version, you probably need to restore it in fresh db : Don’t start any dhis2 against the db
Then look at the content of flyway_schema_history
select * from flyway_schema_history;
+------------------+-----------+-----------------------------------------------------------------------------------------------------------------------------------------------+----------+------------------------------------------------------------------>
| installed_rank | version | description | type | script >
|------------------+-----------+-----------------------------------------------------------------------------------------------------------------------------------------------+----------+------------------------------------------------------------------>
| 1 | 1 | << Flyway Baseline >> | BASELINE | << Flyway Baseline >> >
| 2 | 2.30.0 | Populate dhis2 schema if empty database | JDBC | org.hisp.dhis.db.migration.base.V2_30_0__Populate_dhis2_schema_if>
| 3 | 2.31.1 | Migrations for release v31 | SQL | 2.31/V2_31_1__Migrations_for_release_v31.sql >
| 4 | 2.31.2 | Job configuration param to jsonb | JDBC | org.hisp.dhis.db.migration.v31.V2_31_2__Job_configuration_param_t>
| 5 | 2.31.3 | Program notification template to templateid | JDBC | org.hisp.dhis.db.migration.v31.V2_31_3__Program_notification_temp>
| 6 | 2.31.4 | Add defaults for validationstrategy | JDBC | org.hisp.dhis.db.migration.v31.V2_31_4__Add_defaults_for_validati>
| 7 | 2.31.5 | Add new user role for new capture app | JDBC | org.hisp.dhis.db.migration.v31.V2_31_5__Add_new_user_role_for_new>
by inspecting the version you might be able to guess the correction version to start the dhis2.
if you don’t have the flyway_schema_history table then either the backup is incomplete or it’s a much older version.
select version from flyway_schema_history order by installed_rank desc; is perhaps easier to find latest migration version.