server icon indicating copy to clipboard operation
server copied to clipboard

DB error when running migration [...] collides with the constraint [...]

Open Miyamoto72 opened this issue 1 year ago • 77 comments

⚠️ This issue respects the following points: ⚠️

Bug description

Just found NC 28.0.0 beta available and started the update on the command line. Here's the output of the upgrade process:

Nextcloud Updater - version: v27.1.0rc3-15-gfa7af53

Current version is 27.1.3.

Update to Nextcloud 28.0.0 beta 1 available. (channel: "beta") Following file will be downloaded automatically: https://download.nextcloud.com/server/prereleases/nextcloud-28.0.0beta1.zip

Steps that will be executed: [ ] Check for expected files [ ] Check for write permissions [ ] Create backup [ ] Downloading [ ] Verify integrity [ ] Extracting [ ] Enable maintenance mode [ ] Replace entry points [ ] Delete old files [ ] Move new files in place [ ] Done

Start update? [y/N] y

Info: Pressing Ctrl-C will finish the currently running step and then stops the updater.

[✔] Check for expected files [✔] Check for write permissions [✔] Create backup [✔] Downloading [✔] Verify integrity [✔] Extracting [✔] Enable maintenance mode [✔] Replace entry points [✔] Delete old files [✔] Move new files in place [✔] Done

Update of code successful.

Should the "occ upgrade" command be executed? [Y/n] y Nextcloud or one of the apps require upgrade - only a limited number of commands are available You may use your browser or the occ upgrade command to do the upgrade Setting log level to debug Repair step: Repair MySQL collation Repair info: All tables already have the correct collation -> nothing to do Repair step: Copy data from accounts table when migrating from ownCloud Repair step: Drop account terms table when migrating from ownCloud Updating database schema Exception: Database error when running migration 28000Date20230906104802 for app core Index name "ts_session" for table "oc_talk_sessions" collides with the constraint on table "oc_text_steps". Update failed Maintenance mode is kept active Resetting log level

Keep maintenance mode active? [y/N] Nextcloud or one of the apps require upgrade - only a limited number of commands are available You may use your browser or the occ upgrade command to do the upgrade Maintenance mode disabled

Maintenance mode is disabled

Steps to reproduce

  1. have an update date NC 27 installation running
  2. be on beta channel
  3. start the upgrade once you find the notice

Expected behavior

Upgrade running smootly without errors

Installation method

None

Nextcloud Server version

27

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.1

Web server

Nginx

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

Upgraded to a MAJOR version (ex. 22 to 23)

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

  • [X] Default user-backend (database)
  • [ ] LDAP/ Active Directory
  • [ ] SSO - SAML
  • [ ] Other

Configuration report

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "example.org",
            "cloud.example.org",
            "192.168.1.*",
            "nextcloud.example.org"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "27.1.3.2",
        "overwrite.cli.url": "http:\/\/localhost",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "activity_expire_days": 14,
        "auth.bruteforce.protection.enabled": true,
        "blacklisted_files": [
            ".htaccess",
            "Thumbs.db",
            "thumbs.db"
        ],
        "cron_log": true,
        "enable_previews": true,
        "enabledPreviewProviders": [
            "OC\\Preview\\PNG",
            "OC\\Preview\\JPEG",
            "OC\\Preview\\GIF",
            "OC\\Preview\\BMP",
            "OC\\Preview\\XBitmap",
            "OC\\Preview\\Movie",
            "OC\\Preview\\PDF",
            "OC\\Preview\\MP3",
            "OC\\Preview\\TXT",
            "OC\\Preview\\MarkDown"
        ],
        "filesystem_check_changes": 1,
        "filelocking.enabled": "true",
        "htaccess.RewriteBase": "\/",
        "integrity.check.disabled": false,
        "knowledgebaseenabled": false,
        "logfile": "\/mnt\/STOR\/logs\/nextcloud.log",
        "loglevel": 0,
        "logtimezone": "Europe\/Berlin",
        "log_rotate_size": 104857600,
        "maintenance": false,
        "memcache.local": "\\OC\\Memcache\\APCu",
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "timeout": 0
        },
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "overwriteprotocol": "https",
        "preview_max_x": 1024,
        "preview_max_y": 768,
        "preview_max_scale_factor": 1,
        "quota_include_external_storage": false,
        "share_folder": "\/Shares",
        "skeletondirectory": "",
        "theme": "",
        "trashbin_retention_obligation": "auto, 7",
        "updater.release.channel": "beta",
        "mail_smtpmode": "sendmail",
        "mail_sendmailmode": "pipe",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpauth": 1,
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "587",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpsecure": "tls",
        "default_phone_region": "DE",
        "app_install_overwrite": [
            "dicomviewer",
            "files_mindmap",
            "carnet",
            "onlyoffice",
            "richdocuments",
            "richdocumentscode",
            "documentserver_community",
            "files_photospheres",
            "telephoneprovider",
            "audioplayer",
            "audioplayer_editor",
            "extract",
            "tasks",
            "ocsms",
            "files_trackdownloads",
            "ocdownloader",
            "twofactor_u2f",
            "checksum",
            "event_update_notification",
            "mindmap_app",
            "contacts",
            "deck",
            "spreed",
            "twofactor_webauthn",
            "maps"
        ],
        "has_rebuilt_cache": true
    }
}

List of activated Apps

Enabled:
  - activity: 2.19.0
  - admin_audit: 1.17.0
  - audioplayer: 3.4.0
  - bruteforcesettings: 2.7.0
  - calendar: 4.6.0-beta.1
  - carnet: 0.25.2
  - checksum: 1.2.2
  - circles: 27.0.1
  - cloud_federation_api: 1.10.0
  - comments: 1.17.0
  - contacts: 5.5.0-beta.3
  - contactsinteraction: 1.8.0
  - dashboard: 7.7.0
  - dav: 1.27.0
  - deck: 1.11.0
  - documentserver_community: 0.1.13
  - event_update_notification: 2.2.0
  - extract: 1.3.6
  - federatedfilesharing: 1.17.0
  - federation: 1.17.0
  - files: 1.22.0
  - files_external: 1.19.0
  - files_mindmap: 0.0.29
  - files_pdfviewer: 2.8.0
  - files_photospheres: 1.27.0
  - files_reminders: 1.0.0
  - files_sharing: 1.19.0
  - files_trackdownloads: 1.11.0
  - files_trashbin: 1.17.0
  - files_versions: 1.20.0
  - impersonate: 1.14.0
  - logreader: 2.12.0
  - lookup_server_connector: 1.15.0
  - mail: 3.5.0-beta.1
  - maps: 1.2.0
  - nextcloud_announcements: 1.16.0
  - notes: 4.8.1
  - notifications: 2.15.0
  - oauth2: 1.15.1
  - ocdownloader: 1.9.1
  - password_policy: 1.17.0
  - photos: 2.3.0
  - previewgenerator: 5.3.0
  - privacy: 1.11.0
  - provisioning_api: 1.17.0
  - recommendations: 1.6.0
  - related_resources: 1.2.0
  - richdocuments: 8.2.2
  - richdocumentscode: 23.5.503
  - serverinfo: 1.17.0
  - settings: 1.9.0
  - sharebymail: 1.17.0
  - sociallogin: 5.5.4
  - spreed: 17.1.2
  - support: 1.10.0
  - survey_client: 1.15.0
  - suspicious_login: 5.0.0
  - systemtags: 1.17.0
  - tasks: 0.15.0
  - telephoneprovider: 1.0.3
  - text: 3.8.0
  - theming: 2.2.0
  - twofactor_backupcodes: 1.16.0
  - twofactor_totp: 9.0.0
  - twofactor_webauthn: 1.2.0
  - updatenotification: 1.17.0
  - user_status: 1.7.0
  - viewer: 2.1.0
  - weather_status: 1.7.0
  - workflowengine: 2.9.0
Disabled:
  - encryption: 2.16.0
  - firstrunwizard: 2.17.0 (installed 2.7.0)
  - user_ldap: 1.19.0

Nextcloud Signing status

No response

Nextcloud Logs

none available

Additional info

No response

Miyamoto72 avatar Nov 03 '23 02:11 Miyamoto72

Enter your mysql console -> use nextcloud; (or whatever your database is called) -> drop index 'ts_session' from 'oc_text_steps'; -> occ upgrade -> occ add missing-indices.

axeljerabek avatar Nov 03 '23 05:11 axeljerabek

The code is already changed: https://github.com/nextcloud/text/pull/4553

Apparently an existing index was not renamed: https://github.com/nextcloud/text/issues/4958

kesselb avatar Nov 03 '23 18:11 kesselb

I have an similar issue, with the tables switched, updating from 27.1.3.2 to 28 beta3

Exception: Database error when running migration 28000Date20230906104802 for app core
Index name "ts_session" for table "oc_text_steps" collides with the constraint on table "oc_talk_sessions".

I dropped the index from oc_talk_sessions (drop index ts_session on oc_talk_sessions;) because i don't have Talk installed and the occ upgrade went smooth.

march42 avatar Nov 15 '23 13:11 march42

Another report:

Exception: Database error when running migration 28000Date20230906104802 for app core Index name "afoa" for table "oc_social_follow" collides with the constraint on table "oc_social_3_follow".

solracsf avatar Dec 12 '23 08:12 solracsf

Exception: Database error when running migration 28000Date20230906104802 for app core
Index name "rd_wopi_token_idx" for table "oc_officeonline_wopi" collides with the constraint on table "oc_richdocuments_wopi".

(Upgrade 27.7.4 to 28.0.0)

FahrJo avatar Dec 12 '23 13:12 FahrJo

After successfully upgrading from 27.7.3 to 27.7.4 I then proceeded to upgrade to 28.0.0 and also got this error, but also with another index:

Database error when running migration 28000Date20230906104802 for app core Index name "nid" for table "oc_social_3_stream" collides with the constraint on table "oc_social_3_cache_actor".

I have no idea what to do now. I guess I'll see how to restore my site.

JanSchnacki avatar Dec 12 '23 16:12 JanSchnacki

Other seem to have been able to just delete the offending index. Unfortunately, this "nid" index is the AUTO_INCREMENT column. That index is mandatory.

JanSchnacki avatar Dec 12 '23 19:12 JanSchnacki

I also have the same issue with different index and table: Exception: Database error when running migration 28000Date20230906104802 for app core Index name "fs_storage_mimepart" for table "oc_filecache" collides with the constraint on table "oc_oc_filecache_wkiceckq6l6vf". Update failed. What I can do here to finish the upgrade?

Killerjoe avatar Dec 12 '23 21:12 Killerjoe

I now have dropped the empty table "oc_oc_filecache_wkiceckq6l6vf" and was restarting the upgrade in the console with occ upgrade and the upgrade was running further. I don´t know which sideeffects this will have, but as the table was empty, maybe not that much. We will see.

Killerjoe avatar Dec 12 '23 21:12 Killerjoe

Related to this PR: #39506 for #39488

This new check is for postgres, but it runs against all dbs. That's fine because it should be fixed across the board.

The original report's issue was a legit new bug fixed in nextcloud/text#4998 due to the beta (people upgrading from the beta may be impacted).

But now this new check is catching a lot of ancient (e.g. unused/uninstalled/disabled) app db tables maybe? That would explain why these aren't already cleaned up. The reason I suspect this is because otherwise every one of these environments would have already been broken prior to this change.

joshtrichards avatar Dec 13 '23 00:12 joshtrichards

In my case on 28.0.0 release:

Exception: Database error when running migration 28000Date20230906104802 for app core Index name "activity_filter_app" for table "oc_activity" collides with the constraint on table "oc_oc_activity_zsczy1np8xz63".

Using the above suggestion, this has helped: MariaDB [nextcloud]> drop index activity_filter_app ON oc_activity;

piojan avatar Dec 13 '23 01:12 piojan

Alright been analyzing the reports so far and here's what I've got:

Index name "ts_session" for table "oc_talk_sessions" collides with the constraint on table "oc_text_steps".

Resulting from beta NC28. Fixed previously and was the original issue this report was about. However out of that a new check was added to proactively prevent that problem in the future (which is what all these new follow-on reports are actually about now that NC28 is out with this check in place). In theory that should have been fine, but a lot of existing installations have tables left from no-longer-installed apps as well as transient tables created for various reasons over the years long forgotten about... and there's where the below come in:

Index name "afoa" for table "oc_social_follow" collides with the constraint on table "oc_social_3_follow".

social_3 was an ancient table named used by the social app. That table is likely stale (unused) in this person's environment. Hence it was never fixed. Could/should just be dropped, but not really something we should do in Server for an app that may not even be installed anymore.

Index name "rd_wopi_token_idx" for table "oc_officeonline_wopi" collides with the constraint on table "oc_richdocuments_wopi".

Ditto. Educated guess is this person's environment has had both Office Online and Nextcloud Office installed, but currently only one - or neither - is in-use.

Index name "nid" for table "oc_social_3_stream" collides with the constraint on table "oc_social_3_cache_actor".

Ditto.

Index name "fs_storage_mimepart" for table "oc_filecache" collides with the constraint on table "oc_oc_filecache_wkiceckq6l6vf".

oc_oc_filecache_wkiceckq6l6vf sounds like a bogus table. Maybe something left around from some manually performed migration a long time ago or a partial restore or something.

Index name "activity_filter_app" for table "oc_activity" collides with the constraint on table "oc_oc_activity_zsczy1np8xz63".

Same situation as the last one.

Since we (in server that is) can't (well shouldn't) arbitrarily drop tables/indexes/etc for apps that may not even be installed anymore we should probably:

and/or

  • add logic in it to only check tables for apps that are currently installed and active so that we don't pick up dormant stuff that will never be fixed by their respective app (though this kinda defeats the purpose and doesn't fix the underlying problem)

Edit: There also might be some apps that don't support postgresql and thus ignore these constraints. So possibly a third block of people, but I'm not sure how many apps fall into that category these days.

joshtrichards avatar Dec 13 '23 01:12 joshtrichards

Thank you @joshtrichards, while I'm comfortable with a lot of IT systems, I wouldn't be comfortable with doing such an analysis. I took your research result regarding "oc_social_3" and just removed all of those tables. The upgrade then finished successfully. (Now I have funny "Zend OPcache can't be temporary enabled" messages, that are flooding the logs, but I'll research that separately.)

JanSchnacki avatar Dec 13 '23 07:12 JanSchnacki

I had the same issue for oc_social_3_* tables. I dropped all the tables : drop table oc_social_3_action; drop table oc_social_3_actor; drop table oc_social_3_cache_actor; drop table oc_social_3_cache_doc; drop table oc_social_3_client; drop table oc_social_3_follow; drop table oc_social_3_hashtag; drop table oc_social_3_instance; drop table oc_social_3_req_queue; drop table oc_social_3_stream; drop table oc_social_3_stream_act ; drop table oc_social_3_stream_dest; drop table oc_social_3_stream_queue; drop table oc_social_3_stream_tag;

And the upgrade went fine. What is strange is I don't use the social app and I don't really remember installing it in the past, but I'm not sure, maybe I installed a really old version and had theses tables installed.

At least, after dropping it, upgrade worked without issue.

After looking in the code of the social app, I found no table name like that BUT this: https://github.com/nextcloud/social/issues/1250

Quite old. So I suppose it belong to and older version of the app, that I tested and removed, but the tables were never removed and stayed in the db.

So @joshtrichards I think you are right on your analysis about these orphaned tables.

Thank you for that

Neurozone avatar Dec 13 '23 09:12 Neurozone

Another issue like that? Exception: Database error when running migration 28000Date20230906104802 for app core Foreign key name "FK_8843EB9B3C947C0F" for table "oc_polls_comments" collides with the constraint on table "oc_polls_comments".

dennishohmann avatar Dec 13 '23 10:12 dennishohmann

I now have dropped the empty table "oc_oc_filecache_wkiceckq6l6vf" and was restarting the upgrade in the console with occ upgrade and the upgrade was running further. I don´t know which sideeffects this will have, but as the table was empty, maybe not that much. We will see.

Same issue here with two tables called oc_oc_filecache_q9ip3epux6xn3 and oc_oc_filecache_b9cl8t7yjar3d. Dropping the two tables helped. Both were empty.

Error message was:

Exception: Database error when running migration 28000Date20230906104802 for app core Index name "fs_storage_mimepart" for table "oc_oc_filecache_q9ip3epux6xn3" collides with the constraint on table "oc_filecache".

cnmicha avatar Dec 13 '23 10:12 cnmicha

Same issue:

Exception: Database error when running migration 28000Date20230906104802 for app core
Index name "nid" for table "oc_social_3_stream" collides with the constraint on table "oc_social_3_cache_actor".

Dropping both tables fixed the issue.

MarekPikula avatar Dec 13 '23 10:12 MarekPikula

Similar issue on 27->28 upgrade but with:

Exception: Database error when running migration 28000Date20230906104802 for app core Index name "file_source_index" for table "oc_oc_share_zte3qkhamkm25" collides with the constraint on table "oc_share".

fr33tux avatar Dec 13 '23 10:12 fr33tux

I've had dropping the index in each oc table Exception: Database error when running migration 28000Date20230906104802 for app core Index name "activity_filter" for table "oc_activity" collides with the constraint on table "activity".

Exception: Database error when running migration 28000Date20230906104802 for app core Index name "amp_timestamp_time" for table "oc_activity_mq" collides with the constraint on table "activity_mq".

Exception: Database error when running migration 28000Date20230906104802 for app core Index name "addressbookid_synctoken" for table "oc_addressbookchanges" collides with the constraint on table "addressbookchanges".

Exception: Database error when running migration 28000Date20230906104802 for app core Index name "addressbook_index" for table "oc_addressbooks" collides with the constraint on table "addressbooks".

I think they're right that these oc_ tables are orphans, but I don't want to go deleting half the oc_ tables in my database unless I'm sure.

I do have backups though and run a dump before I started so it should be fine.

I also tried going back to 27 but just gave me other errors.

Deanosim avatar Dec 13 '23 10:12 Deanosim

I think they're right that these oc_ tables are orphans, but I don't want to go deleting half the oc_ tables in my database unless I'm sure.

have you changed the setting dbtableprefix in your config.php at some time or a second nextcloud instance in the same DB just without the prefix? In all previous cases, the conflicts came from different tables but in your case, it seems like the tables are there just twice with and without the dbtableprefix.

FahrJo avatar Dec 13 '23 10:12 FahrJo

I think they're right that these oc_ tables are orphans, but I don't want to go deleting half the oc_ tables in my database unless I'm sure.

have you changed the setting dbtableprefix in your config.php at some time or a second nextcloud instance in the same DB just without the prefix? In all previous cases, the conflicts came from different tables but in your case, it seems like the tables are there just twice with and without the dbtableprefix.

Not that I remember, dbtableprefix is set to nothing in my config, I know I moved from the official nextcloud docker image to the linuxserver.io image years ago. I don't really remember anything else.

I can see in the config.sample.php it's default is oc_ I have no idea what's happened, it was working fine on nextcloud 27

Update: managed to fix it, had to just purge all the tables starting with oc_, and then changed the tag on the docker image from latest to 27.1.4 to stop it.

Deanosim avatar Dec 13 '23 11:12 Deanosim

Aktualisierung auf 28.0.0

Exception: Database error when running migration 28000Date20230906104802 for app core Index name "appconfig_config_key_index" for table "appconfig" collides with the constraint on table "oc_appconfig".
Detaillierte Protokollmeldungen

Update vorbereiten

Log-Level auf "debug" gesetzt

Wartungsmodus eingeschaltet

Reparaturschritt: Repair MySQL collation

Reparaturinformation: All tables already have the correct collation -> nothing to do

Reparaturschritt: Copy data from accounts table when migrating from ownCloud

Reparaturschritt: Drop account terms table when migrating from ownCloud

Das Datenbankschema wird aktualisiert

Exception: Database error when running migration 28000Date20230906104802 for app core Index name "appconfig_config_key_index" for table "appconfig" collides with the constraint on table "oc_appconfig".


Similar issue here, prefix is not set in config

cstegm avatar Dec 13 '23 14:12 cstegm

Looks like my issue is the same as duplicate issue #42232. I ran into this issue when upgrading from 27 > 28 (occ upgrade). I managed to finish the upgrade by disabling the user_ldap app. However, I'm still not able to re-enable the app. The difference with my error and #42232 is that, unlike many of the ones reported here, I'm not sure which table to drop/edit or what steps to take next.

Here's what I get when I try to enable user_ldap:

sudo -u www-data php /var/www/nextcloud/occ app:enable user_ldap
Database error when running migration 1190Date20230706134108 for app user_ldap
An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'Domain Admins-A24027C7-7F24-47D6-8D60-EF483304215D' for key 'user_ldap_membership_unique'

I'm not sure if I'm even looking in the right place, but I do not see a duplicate entry in these tables:

oc_ldap_group_members
oc_ldap_group_membership
oc_ldap_user_mapping

I don't know if I'm convinced my issue and #42232 really are a duplicate of this issue. Perhaps ours is maybe more of a duplicate of #38902?

pebkacs avatar Dec 13 '23 23:12 pebkacs

Same here with multiple errors like this one :

Exception: Database error when running migration 28000Date20230906104802 for app core
Index name "appconfig_config_key_index" for table "oc_oc_appconfig_rzt396ok7dl48" collides with the constraint on table "oc_oc_appconfig_ymb6p8xmkhuc7".
Update failed

Had to enter in the mysql container then run :

drop index appconfig_config_key_index on oc_appconfig;
drop index appconfig_appid_key on oc_oc_appconfig_rzt396ok7dl48;
drop index appconfig_config_key_index on oc_oc_appconfig_rzt396ok7dl48;

Xav-Pe avatar Dec 14 '23 14:12 Xav-Pe

Looks like my issue is the same as duplicate issue #42232. I ran into this issue when upgrading from 27 > 28 (occ upgrade). I managed to finish the upgrade by disabling the user_ldap app. However, I'm still not able to re-enable the app. The difference with my error and #42232 is that, unlike many of the ones reported here, I'm not sure which table to drop/edit or what steps to take next.

Here's what I get when I try to enable user_ldap:

sudo -u www-data php /var/www/nextcloud/occ app:enable user_ldap
Database error when running migration 1190Date20230706134108 for app user_ldap
An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'Domain Admins-A24027C7-7F24-47D6-8D60-EF483304215D' for key 'user_ldap_membership_unique'

I'm not sure if I'm even looking in the right place, but I do not see a duplicate entry in these tables:

oc_ldap_group_members
oc_ldap_group_membership
oc_ldap_user_mapping

I don't know if I'm convinced my issue and #42232 really are a duplicate of this issue. Perhaps ours is maybe more of a duplicate of #38902?

It seems for me, that this fails: https://github.com/nextcloud/server/blob/v28.0.0/apps/user_ldap/lib/Migration/Version1190Date20230706134108.php

stbieri avatar Dec 14 '23 14:12 stbieri

Same here with Index name "storages_id_index" for table "oc_storages" collides with the constraint on table "oc_oc_storages_8i9lkwn5ytz05".

I got through it with a drop index... not 100% shure of what I did!

kiv57 avatar Dec 14 '23 14:12 kiv57

I had the same issue for oc_social_3_* tables. I dropped all the tables : drop table oc_social_3_action; drop table oc_social_3_actor; drop table oc_social_3_cache_actor; drop table oc_social_3_cache_doc; drop table oc_social_3_client; drop table oc_social_3_follow; drop table oc_social_3_hashtag; drop table oc_social_3_instance; drop table oc_social_3_req_queue; drop table oc_social_3_stream; drop table oc_social_3_stream_act ; drop table oc_social_3_stream_dest; drop table oc_social_3_stream_queue; drop table oc_social_3_stream_tag;

That works fine. I also researched the Social plugin table names: https://github.com/nextcloud/social/issues/1871#issuecomment-1862876705

And the ones with a 3 inside aren't in use for quite a while. So long, in fact, that the migrations don't exist anymore.

DivineDominion avatar Dec 19 '23 17:12 DivineDominion

Looks like my issue is the same as duplicate issue #42232. I ran into this issue when upgrading from 27 > 28 (occ upgrade). I managed to finish the upgrade by disabling the user_ldap app. However, I'm still not able to re-enable the app. The difference with my error and #42232 is that, unlike many of the ones reported here, I'm not sure which table to drop/edit or what steps to take next.

Here's what I get when I try to enable user_ldap:

sudo -u www-data php /var/www/nextcloud/occ app:enable user_ldap
Database error when running migration 1190Date20230706134108 for app user_ldap
An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'Domain Admins-A24027C7-7F24-47D6-8D60-EF483304215D' for key 'user_ldap_membership_unique'

I'm not sure if I'm even looking in the right place, but I do not see a duplicate entry in these tables:

oc_ldap_group_members
oc_ldap_group_membership
oc_ldap_user_mapping

I don't know if I'm convinced my issue and #42232 really are a duplicate of this issue. Perhaps ours is maybe more of a duplicate of #38902?

I am facing the same issue. Had to disable ldap for the upgrade to succeed and cannot enable it now. I tried to drop the three tables, but they are being recreated when I try to enable the ldap app and the error still exists.

Did you already find a solution?

jangatzke avatar Dec 20 '23 13:12 jangatzke

I am facing the same issue. Had to disable ldap for the upgrade to succeed and cannot enable it now. I tried to drop the three tables, but they are being recreated when I try to enable the ldap app and the error still exists.

Did you already find a solution?

Unfortunately, no. Not yet. I rolled back my install to the previous version and I am waiting for a patch.

pebkacs avatar Dec 20 '23 16:12 pebkacs

I don't know if I'm convinced my issue and #42232 really are a duplicate of this issue.

@pebkacs @jangatzke @stbieri I apologize - we were getting a lot of reports of the collides with constraint matter covered here (#41253) that I lumped yours in while triaging. Your matters appears to be a specific issue with the user_ldap migration / or at least something brought out by the migration. I've re-opened #42232 to track solely the user_ldap issue of Integrity constraint violation. Again my apologies.

joshtrichards avatar Dec 20 '23 16:12 joshtrichards