500 error after migration to H2

Cannot upload after OrientDB to H2 migration: Unique index or primary key violation #449

Cannot download anything new through pip proxy. Cannot add new objects.

Solution: https://github.com/sonatype/nexus-public/issues/449#issuecomment-2285844522

For docker-compose.yml based installation:

docker-compose.yml
services:
  nexus3:
    image: sonatype/nexus3:3.72.0
    container_name: nexus3
    command: "sleep 3600"
    volumes:
      - "nexus-data:/nexus-data"
migrator_repair.sh
NEXUS_BIN=/opt/sonatype/nexus
NEXUS_DATA=/nexus-data

./migrator_repair.sh script output

> SCRIPT NODATA
> ALTER TABLE TAG ALTER COLUMN ID RESTART WITH SELECT max(ID) + 1 FROM TAG
(Update count: 0, 13 ms)
> ALTER TABLE RAW_CONTENT_REPOSITORY ALTER COLUMN REPOSITORY_ID RESTART WITH SELECT max(REPOSITORY_ID) + 1 FROM RAW_CONTENT_REPOSITORY
(Update count: 0, 14 ms)
...
> ALTER TABLE P2_BROWSE_NODE ALTER COLUMN NODE_ID RESTART WITH SELECT max(NODE_ID) + 1 FROM P2_BROWSE_NODE
(Update count: 0, 13 ms)