Keycloak upgrade with existing data

I am trying to upgrade keycloak from 13 to 22. I have the existing db and tried to connect from keycloak 22 on to the database from keycloak 13. I am using mariabd database.
I am getting below exception

keycloak22 | 2023-11-05 22:57:30,460 INFO [org.keycloak.connections.infinispan.DefaultInfinispanConnectionProviderFactory] (main) Node name: node_229414, Site name: null
keycloak22 | 2023-11-05 22:57:30,472 WARN [org.mariadb.jdbc.message.server.ErrorPacket] (main) Error: 1146-42S02: Table ‘keycloak.MIGRATION_MODEL’ doesn’t exist
keycloak22 | 2023-11-05 22:57:31,209 WARN [org.mariadb.jdbc.message.server.ErrorPacket] (main) Error: 1146-42S02: Table ‘keycloak.DATABASECHANGELOG’ doesn’t exist
keycloak22 | 2023-11-05 22:57:31,745 WARN [org.mariadb.jdbc.message.server.ErrorPacket] (main) Error: 1146-42S02: Table ‘keycloak.DATABASECHANGELOGLOCK’ doesn’t exist
keycloak22 | 2023-11-05 22:57:31,809 WARN [org.mariadb.jdbc.message.server.ErrorPacket] (main) Error: 1146-42S02: Table ‘keycloak.DATABASECHANGELOG’ doesn’t exist
keycloak22 | 2023-11-05 22:57:31,809 INFO [org.keycloak.quarkus.runtime.storage.legacy.liquibase.QuarkusJpaUpdaterProvider] (main) Initializing database schema. Using changelog META-INF/jpa-changelog-master.xml
keycloak22 | 2023-11-05 22:57:32,775 WARN [org.mariadb.jdbc.message.server.ErrorPacket] (main) Error: 1005-HY000: Can’t create table keycloak.CLIENT_SESSION_ROLE (errno: 121 “Duplicate key on write or update”)
keycloak22 | 2023-11-05 22:57:32,936 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: Failed to start server in (development) mode
keycloak22 | 2023-11-05 22:57:32,936 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: Failed to update database
keycloak22 | 2023-11-05 22:57:32,936 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: liquibase.exception.MigrationFailedException: Migration failed for change set META-INF/jpa-changelog-1.0.0.Final.xml::1.0.0.Final-KEYCLOAK-5461::sthorger@redhat.com:
keycloak22 | Reason: liquibase.exception.DatabaseException: (conn=3) Can’t create table keycloak.CLIENT_SESSION_ROLE (errno: 121 “Duplicate key on write or update”) [Failed SQL: (1005) ALTER TABLE keycloak.CLIENT_SESSION_ROLE ADD CONSTRAINT FK_11B7SGQW18I532811V7O2DV76 FOREIGN KEY (CLIENT_SESSION) REFERENCES keycloak.CLIENT_SESSION (ID)]
keycloak22 | 2023-11-05 22:57:32,936 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: Migration failed for change set META-INF/jpa-changelog-1.0.0.Final.xml::1.0.0.Final-KEYCLOAK-5461::sthorger@redhat.com:
keycloak22 | Reason: liquibase.exception.DatabaseException: (conn=3) Can’t create table keycloak.CLIENT_SESSION_ROLE (errno: 121 “Duplicate key on write or update”) [Failed SQL: (1005) ALTER TABLE keycloak.CLIENT_SESSION_ROLE ADD CONSTRAINT FK_11B7SGQW18I532811V7O2DV76 FOREIGN KEY (CLIENT_SESSION) REFERENCES keycloak.CLIENT_SESSION (ID)]
keycloak22 | 2023-11-05 22:57:32,936 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: (conn=3) Can’t create table keycloak.CLIENT_SESSION_ROLE (errno: 121 “Duplicate key on write or update”) [Failed SQL: (1005) ALTER TABLE keycloak.CLIENT_SESSION_ROLE ADD CONSTRAINT FK_11B7SGQW18I532811V7O2DV76 FOREIGN KEY (CLIENT_SESSION) REFERENCES keycloak.CLIENT_SESSION (ID)]
keycloak22 | 2023-11-05 22:57:32,936 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: (conn=3) Can’t create table keycloak.CLIENT_SESSION_ROLE (errno: 121 “Duplicate key on write or update”)
keycloak22 | 2023-11-05 22:57:32,936 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) For more details run the same command passing the ‘–verbose’ option. Also you can use ‘–help’ to see the details about the usage of the particular command.
keycloak22 exited with code 1

Not sure how to fix this. Any suggestions ?