Migrate 2.33 to 2.36


I’m trying to migrate 2.33 to 2.36 but I’m facing to the following error

Caused by: org.flywaydb.core.internal.sqlscript.FlywaySqlScriptException:
Migration V2_34_8__Create_Audit_Table.sql failed
SQL State  : 42P07
Error Code : 0
Message    : ERROR: relation "audit" already exists
Location   : org/hisp/dhis/db/migration/2.34/V2_34_8__Create_Audit_Table.sql (/usr/local/tomcat/file:/usr/local/tomcat/webapps/ROOT/WEB-INF/lib/dhis-support-db-migration-2.36.9.jar!/org/hisp/dhis/db/migration/2.34/V2_34_8__Create_Audit_Table.sql)
Line       : 1
Statement  : CREATE TABLE audit (
    auditType TEXT NOT NULL,
    auditScope TEXT NOT NULL,
    createdBy TEXT NOT NULL,
    klass TEXT,
    uid TEXT,
    code TEXT,
    attributes JSONB default '{}',
    data BYTEA

Hi @didate
Was this the first attempt to migrate to 2.36?
It looks like your db already has the table named “audit” which might have been a previous failed migratio n attempt?
Can you post the results of the below query?

select * from flyway_schema_history order by installed_rank desc;

1 Like

Hello @Ameen,

I received a backup that I somehow managed to restore (with 2.33 and it work), but I don’t really know what was done with the source database.
More information here Retore backup Error : relation "audit" already exists

But yes I also have the impression that an attempt to migrate has been made that it had failed.

I think I’m going to create an empty instance (2.36) and import metadata and data from worked 2.33 instance

Thanks @didate ! Please feel free to post back to the community and what works! :slight_smile::+1: