====== 500 error after migration to H2 ======
[[https://github.com/sonatype/nexus-public/issues/449|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 stop
* disable nexus startup - override startup command:
services:
nexus3:
image: sonatype/nexus3:3.72.0
container_name: nexus3
command: "sleep 3600"
volumes:
- "nexus-data:/nexus-data"
* copy repair script to container volume: ''/var/lib/docker/volumes/nexus3_nexus-data/_data''
* ''chown 200 migrator_script.sh''
* ''chmod +x migrator_script.sh''
* adapt paths in repair script:
NEXUS_BIN=/opt/sonatype/nexus
NEXUS_DATA=/nexus-data
* start container ''docker compose up -d''
* login into container ''docker compose exec nexus3 /bin/bash''
* ''cd /nexus-ddata''
* ''./migrator_repair.sh''
* logour from container: ''CTRL+D''
* stop ''docker compose stop''
* revert changes in ''docker-compose.yml''
* start ''docker compose up -d''
''./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)