Stream: troubleshooting

Topic: ✔ DB migration issues on upgrade from 6.1 to 6.2


view this post on Zulip César Ferreira (Aug 01 2025 at 11:46):

Hi, I am trying to upgrade from version 6.1 to 6.2 using a custom war file and I am getting a lot of sql exceptions from asadmin deploy dataverse.war and in server.log I found the following messages, the last one is about a sql file for db migration that seems to be missing:

PastedText.txt

I checked the war file with the following command and the sql file is there. Any ideas for the cause of this problem and how I can solve it?

jar tf dataverse.war | grep "db/migration/V6.1.0.4__5645-geospatial-fieldname-fix.sql"
WEB-INF/classes/db/migration/V6.1.0.4__5645-geospatial-fieldname-fix.sql

view this post on Zulip Philip Durbin 🚀 (Aug 01 2025 at 12:06):

Hmm...

Caused by: org.flywaydb.core.internal.command.DbMigrate$FlywayMigrateException: Migration V6.1.0.4__5645-geospatial-fieldname-fix.sql failed
------------------------------------------------------------
SQL State  : 23505
Error Code : 0
Message    : ERROR: duplicate key value violates unique constraint "datasetfieldtype_name_key"
  Detail: Key (name)=(northLatitude) already exists.
Location   : db/migration/V6.1.0.4__5645-geospatial-fieldname-fix.sql (/usr/local/payara6/glassfish/domains/domain1/applications/dataverse/WEB-INF/classes/db/migration/V6.1.0.4__5645-geospatial-fieldname-fix.sql)
Line       : 1
Statement  : UPDATE datasetfieldtype
SET name = 'northLatitude'
WHERE name = 'northLongitude'

view this post on Zulip Philip Durbin 🚀 (Aug 01 2025 at 12:07):

#5645 was fixed by @Juan Pablo Tosca Villanueva in PR #10306 in 6.2.

And yes, that PR is where src/main/resources/db/migration/V6.1.0.3__5645-geospatial-fieldname-fix.sql comes from. (The version got bumped to .4 in #10346.)

view this post on Zulip Philip Durbin 🚀 (Aug 01 2025 at 12:17):

This is all the script is doing...

UPDATE datasetfieldtype
SET name = 'northLatitude'
WHERE name = 'northLongitude';

UPDATE datasetfieldtype
SET name = 'southLatitude'
WHERE name = 'southLongitude';

... from https://github.com/IQSS/dataverse/blob/v6.2/src/main/resources/db/migration/V6.1.0.4__5645-geospatial-fieldname-fix.sql

view this post on Zulip Philip Durbin 🚀 (Aug 01 2025 at 12:18):

I'm not sure why this result in the error you're seeing: Message : ERROR: duplicate key value violates unique constraint "datasetfieldtype_name_key" Detail: Key (name)=(northLatitude) already exists.

view this post on Zulip Philip Durbin 🚀 (Aug 01 2025 at 12:18):

@César Ferreira does "northLatitude" already exist in your pre-6.2 database?

view this post on Zulip César Ferreira (Aug 01 2025 at 12:26):

Yes, I already have these fields, maybe it is because I already updated the metadata blocks from the tsv files?

view this post on Zulip Oliver Bertuch (Aug 01 2025 at 12:31):

If you applied the new TSVs to an instance running an older version, that would make things break, yes.

view this post on Zulip Oliver Bertuch (Aug 01 2025 at 12:32):

The easiest way to go around this is probably to edit your database before you restart Dataverse and remove any such failing entries.

view this post on Zulip César Ferreira (Aug 01 2025 at 12:36):

Thank you, that fixed the problem.

view this post on Zulip Notification Bot (Aug 01 2025 at 13:01):

César Ferreira has marked this topic as resolved.


Last updated: Oct 30 2025 at 06:21 UTC