Owncloud 10.16 to Nextcloud Migration - Database preparation for schema update

Support intro

Sorry to hear you’re facing problems. :slightly_frowning_face:

The community help forum (help.nextcloud.com) is for home and non-enterprise users. Support is provided by other community members on a best effort / “as available” basis. All of those responding are volunteering their time to help you.

If you’re using Nextcloud in a business/critical setting, paid and SLA-based support services can be accessed via portal.nextcloud.com where Nextcloud engineers can help ensure your business keeps running smoothly.

Getting help

In order to help you as efficiently (and quickly!) as possible, please fill in as much of the below requested information as you can.

Before clicking submit: Please check if your query is already addressed via the following resources:

(Utilizing these existing resources is typically faster. It also helps reduce the load on our generous volunteers while elevating the signal to noise ratio of the forums otherwise arising from the same queries being posted repeatedly).

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can. :heart:

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • 34.0.4
  • Operating system and version (e.g., Ubuntu 24.04):
    • Ubuntu 24.04.4 LTS
  • PHP version (e.g, 8.3):
    • 8.3

Summary of the issue you are facing:

Migration fails during occ upgrade with error

Exception: Database error when running migration 1006Date20180628111625 for app dav

Steps to replicate it (hint: details matter!):

This is happening in step 5 of Migrating from ownCloud — Nextcloud 35 Administration Manual.

An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘12-0-445347D3-6E31-4E7B-BB53-689DA531319F’ for key ‘oc_calendarobjects.calobjects_by_uid_index’
Update failed

As far as I could establish it looks like the issue is caused by Nextcloud trying to create an index for calendar entries resulting in a constraint violation. I checked the ID in the table and there are over 160 lines with that ID. Digging through the DB it became clear that these are all part of a series with 12 being the ID, 445347D3-6E31-4E7B-BB53-689DA531319F being the UID. This combination exists multiple times but the entries are distinguished by a unique URI representing the recurrences.
It looks that Nextcloud does not consider all three resulting in a primary key violation.

Question is whether there is any script or manual process that needs to be executed before, e.g. serializing the entries to become compatible with Nextcloud indexes?

Any ideas are more than welcome! Thanks!

I would expect all required steps to be included in the migration guide. As it is not the case I would recommend to look through topics tagged owncloud to see if other hit similar issues in the past. If there is no solution I would recommend to check github and (i you can) adjust the migration script to fit your need and ideally provide a PR..

Unfortunately, the effort of finding a technical solution exceeded the effort to just manually migrate the users’ so did the latter. Problem is solved.