nextcloud / nextcloud/circles

[Bug]: Database error when running migration latest for app circles

Open
#1,030 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage bug needs info
Dominant language
JavaScript
Stars
177
Forks
68
Avg merge
2d 22h
Merged PRs (30d)
60

Description

⚠️ This issue respects the following points: ⚠️
  • This is a bug, not a question or a configuration/webserver/proxy issue.
  • This issue is not already reported on Github (I've searched it).
  • Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
  • I agree to follow Nextcloud's Code of Conduct.
Bug description

Upgrade to 23.0.4 fails on "Circles" app

Steps to reproduce
  1. Initiate web-based upgrade to 23.0.4
Expected behavior

Upgrade completes successfully

Installation method

Web installer on a VPS or web space

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.0

Web server

Apache (supported)

Database engine version

MySQL

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

Updated from a minor version (ex. 22.2.3 to 22.2.4)

Are you using the Nextcloud Server Encryption module?

No response

What user-backends are you using?
  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other
Configuration report
{
    "system": {
        "default_phone_region": "US",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "f.bdly.org",
            "fprime.bdly.org"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "23.0.3.2",
        "overwrite.cli.url": "https:\/\/f.bdly.org",
        "htaccess.RewriteBase": "\/",
        "dbdriveroptions": {
            "1009": "\/etc\/ssl\/certs\/nextcloud-mysql.crt",
            "1014": true
        },
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "installed": true,
        "mail_smtpmode": "smtp",
        "mail_smtpsecure": "tls",
        "mail_sendmailmode": "smtp",
        "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***",
        "maintenance": false,
        "theme": "",
        "loglevel": 0,
        "updater.secret": "***REMOVED SENSITIVE VALUE***"
    }
}
List of activated Apps
Enabled:
  - accessibility: 1.9.0
  - activity: 2.15.0
  - bruteforcesettings: 2.3.0
  - calendar: 3.2.2
  - circles: 23.1.0
  - cloud_federation_api: 1.6.0
  - comments: 1.13.0
  - contacts: 4.1.0
  - contactsinteraction: 1.4.0
  - dashboard: 7.3.0
  - dav: 1.21.0
  - federatedfilesharing: 1.13.0
  - federation: 1.13.0
  - files: 1.18.0
  - files_fulltextsearch: 23.0.0
  - files_pdfviewer: 2.4.0
  - files_rightclick: 1.2.0
  - files_sharing: 1.15.0
  - files_trashbin: 1.13.0
  - files_versions: 1.16.0
  - files_videoplayer: 1.12.0
  - firstrunwizard: 2.12.0
  - fulltextsearch: 23.0.0
  - fulltextsearch_elasticsearch: 23.0.0
  - logreader: 2.8.0
  - lookup_server_connector: 1.11.0
  - mail: 1.11.7
  - nextcloud_announcements: 1.12.0
  - notifications: 2.11.1
  - oauth2: 1.11.0
  - password_policy: 1.13.0
  - photos: 1.5.0
  - privacy: 1.7.0
  - provisioning_api: 1.13.0
  - recommendations: 1.2.0
  - richdocuments: 5.0.3
  - serverinfo: 1.13.0
  - settings: 1.5.0
  - sharebymail: 1.13.0
  - spreed: 13.0.4
  - support: 1.6.0
  - survey_client: 1.11.0
  - systemtags: 1.13.0
  - text: 3.4.1
  - theming: 1.14.0
  - twofactor_backupcodes: 1.12.0
  - twofactor_totp: 6.2.0
  - updatenotification: 1.13.0
  - user_status: 1.3.1
  - viewer: 1.7.0
  - weather_status: 1.3.0
  - workflowengine: 2.5.0
Disabled:
  - admin_audit
  - encryption
  - files_external
  - user_ldap
Nextcloud Signing status

No response

Nextcloud Logs
qsx8agM%3D%3AVkwlcoPED10dz6kxUKuPq5kU2cPox1FOICUU4Y8mO2Q%3D","message":"Database error when running migration latest for app circles","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:99.0) Gecko/20100101 Firefox/99.0","version":"23.0.3.2","exception":{"Exception":"Exception","Message":"Database error when running migration latest for app circles","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/legacy/OC_App.php","line":1021,"function":"migrate","class":"OC\\DB\\MigrationService","type":"->"},{"file":"/var/www/nextcloud/lib/private/Updater.php","line":353,"function":"updateApp","class":"OC_App","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/private/Updater.php","line":265,"function":"doAppUpgrade","class":"OC\\Updater","type":"->"},{"file":"/var/www/nextcloud/lib/private/Updater.php","line":133,"function":"doUpgrade","class":"OC\\Updater","type":"->"},{"file":"/var/www/nextcloud/core/ajax/update.php","line":194,"function":"upgrade","class":"OC\\Updater","type":"->"}],"File":"/var/www/nextcloud/lib/private/DB/MigrationService.php","Line":429,"Previous":{"Exception":"Doctrine\\DBAL\\Exception\\DriverException","Message":"An exception occurred while executing a query: SQLSTATE[HY000]: General error: 3750 Unable to create or change a table without a primary key, when the system variable 'sql_require_primary_key' is set. Add a primary key to the table or unset this variable to avoid this message. Note that tables without a primary key can cause performance problems in row-based replication, so please consult your DBA before changing this setting.","Code":3750,"Trace":[{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1780,"function":"convert","class":"Doctrine\\DBAL\\Driver\\API\\MySQL\\ExceptionConverter","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1719,"function":"handleDriverException","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1067,"function":"convertExceptionDuringQuery","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/Connection.php","line":237,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1809,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/Migrator.php","line":175,"function":"query","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/Migrator.php","line":76,"function":"applySchema","class":"OC\\DB\\Migrator","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/Connection.php","line":546,"function":"migrate","class":"OC\\DB\\Migrator","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/MigrationService.php","line":540,"function":"migrateToSchema","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/MigrationService.php","line":425,"function":"executeStep","class":"OC\\DB\\MigrationService","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_App.php","line":1021,"function":"migrate","class":"OC\\DB\\MigrationService","type":"->"},{"file":"/var/www/nextcloud/lib/private/Updater.php","line":353,"function":"updateApp","class":"OC_App","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/private/Updater.php","line":265,"function":"doAppUpgrade","class":"OC\\Updater","type":"->"},{"file":"/var/www/nextcloud/lib/private/Updater.php","line":133,"function":"doUpgrade","class":"OC\\Updater","type":"->"},{"file":"/var/www/nextcloud/core/ajax/update.php","line":194,"function":"upgrade","class":"OC\\Updater","type":"->"}],"File":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php","Line":114,"Previous":{"Exception":"Doctrine\\DBAL\\Driver\\PDO\\Exception","Message":"SQLSTATE[HY000]: General error: 3750 Unable to create or change a table without a primary key, when the system variable 'sql_require_primary_key' is set. Add a primary key to the table or unset this variable to avoid this message. Note that tables without a primary key can cause performance problems in row-based replication, so please consult your DBA before changing this setting.","Code":3750,"Trace":[{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Connection.php","line":87,"function":"new","class":"Doctrine\\DBAL\\Driver\\PDO\\Exception","type":"::"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1062,"function":"query","class":"Doctrine\\DBAL\\Driver\\PDO\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/Connection.php","line":237,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1809,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/Migrator.php","line":175,"function":"query","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/Migrator.php","line":76,"function":"applySchema","class":"OC\\DB\\Migrator","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/Connection.php","line":546,"function":"migrate","class":"OC\\DB\\Migrator","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/MigrationService.php","line":540,"function":"migrateToSchema","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/MigrationService.php","line":425,"function":"executeStep","class":"OC\\DB\\MigrationService","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_App.php","line":1021,"function":"migrate","class":"OC\\DB\\MigrationService","type":"->"},{"file":"/var/www/nextcloud/lib/private/Updater.php","line":353,"function":"updateApp","class":"OC_App","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/private/Updater.php","line":265,"function":"doAppUpgrade","class":"OC\\Updater","type":"->"},{"file":"/var/www/nextcloud/lib/private/Updater.php","line":133,"function":"doUpgrade","class":"OC\\Updater","type":"->"},{"file":"/var/www/nextcloud/core/ajax/update.php","line":194,"function":"upgrade","class":"OC\\Updater","type":"->"}],"File":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Exception.php","Line":26,"Previous":{"Exception":"PDOException","Message":"SQLSTATE[HY000]: General error: 3750 Unable to create or change a table without a primary key, when the system variable 'sql_require_primary_key' is set. Add a primary key to the table or unset this variable to avoid this message. Note that tables without a primary key can cause performance problems in row-based replication, so please consult your DBA before changing this setting.","Code":"HY000","Trace":[{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Connection.php","line":82,"function":"query","class":"PDO","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1062,"function":"query","class":"Doctrine\\DBAL\\Driver\\PDO\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/Connection.php","line":237,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1809,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/Migrator.php","line":175,"function":"query","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/Migrator.php","line":76,"function":"applySchema","class":"OC\\DB\\Migrator","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/Connection.php","line":546,"function":"migrate","class":"OC\\DB\\Migrator","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/MigrationService.php","line":540,"function":"migrateToSchema","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/MigrationService.php","line":425,"function":"executeStep","class":"OC\\DB\\MigrationService","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_App.php","line":1021,"function":"migrate","class":"OC\\DB\\MigrationService","type":"->"},{"file":"/var/www/nextcloud/lib/private/Updater.php","line":353,"function":"updateApp","class":"OC_App","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/private/Updater.php","line":265,"function":"doAppUpgrade","class":"OC\\Updater","type":"->"},{"file":"/var/www/nextcloud/lib/private/Updater.php","line":133,"function":"doUpgrade","class":"OC\\Updater","type":"->"},{"file":"/var/www/nextcloud/core/ajax/update.php","line":194,"function":"upgrade","class":"OC\\Updater","type":"->"}],"File":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Connection.php","Line":82}}},"CustomMessage":"Database error when running migration latest for app circles"}}
Additional info

Pasting what I believe to be the relevant portion of nextcloud.log. Looks like a table needs a primary key?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the migration path named in the trace: lib/private/DB/MigrationService.php and lib/private/DB/Migrator.php, then locate the Circles schema migration that fails under MySQL's sql_require_primary_key setting. Reproduce the upgrade failure and verify that the Circles migration completes successfully with that setting enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.