Server: An exception occurred while executing 'INSERT INTO `migrations` (`app`,`version`)

Created on 15 Dec 2017  路  12Comments  路  Source: nextcloud/server

Steps to reproduce

  1. Backup Nextcloud 12.0.4 install
  2. Set upgrade channel to Beta
  3. Attempt to upgrade to Nextcloud 13 beta 3
  4. Click the "Start Upgrade screen on the web upgrader.

Expected behaviour

For the database to finish upgrading

Actual behaviour

Got this error in both web interface and from ssh into the server.

Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'INSERT INTO `migrations` (`app`,`version`) SELECT ?,? FROM `migrations` WHERE `app` = ? AND `version` = ? HAVING COUNT(*) = 0' with params ["core", "13000Date20170705121758", "core", "13000Date20170705121758"]:

SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'version' at row 1
Update failed

Server configuration

Operating system: CentOS 6.9 (final)

Web server: Nginx 1.12.2

Database: mysql Ver 15.1 Distrib 10.2.11-MariaDB, for Linux (x86_64) using readline 5.1

PHP version: PHP 7.1.12 (cli) (built: Nov 27 2017 11:00:37) ( NTS )

Nextcloud version: (see Nextcloud admin page) 13 beta 3

Updated from an older Nextcloud/ownCloud or fresh install: existing 12.04

Where did you install Nextcloud from:

List of activated apps:
sudo -u nginx php occ app:list
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

Enabled:

  • activity: 2.5.2
  • admin_audit: 1.2.0
  • bruteforcesettings: 1.0.3
  • caniupdate: 0.1.1
  • comments: 1.2.0
  • dav: 1.3.0
  • federatedfilesharing: 1.2.0
  • files: 1.7.2
  • files_external: 1.3.0
  • files_pdfviewer: 1.1.1
  • files_sharing: 1.4.0
  • files_texteditor: 2.4.1
  • files_trashbin: 1.2.0
  • files_versions: 1.5.0
  • gallery: 17.0.0
  • logreader: 2.0.0
  • lookup_server_connector: 1.0.0
  • oauth2: 1.0.5
  • password_policy: 1.2.2
  • provisioning_api: 1.2.0
  • ransomware_protection: 1.0.5
  • serverinfo: 1.2.0
  • sharebymail: 1.2.0
  • socialsharing_twitter: 1.0.2
  • theming: 1.3.0
  • theming_customcss: 1.0.0
  • twofactor_backupcodes: 1.1.1
  • twofactor_totp: 1.3.1
  • updatenotification: 1.2.0
  • user_external: 0.4
  • workflowengine: 1.2.0
    Disabled:
  • encryption
  • federation
  • files_videoplayer
  • firstrunwizard
  • nextcloud_announcements
  • notifications
  • survey_client
  • systemtags
  • user_ldap

Nextcloud configuration:
sudo -u nginx php occ config:list

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
{
    "system": {
        "memcache.local": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "brooke.pub",
            "cdn.brooke.pub"
        ],
        "overwrite.cli.url": "https:\/\/example.com",
        "overwriteprotocol": "https",
        "htaccess.IgnoreFrontController": true,
        "dbtype": "mysql",
        "version": "12.0.4.3",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbtableprefix": "",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "logtimezone": "UTC",
        "installed": true,
        "mail_smtpmode": "smtp",
        "lost_password_link": "https:\/\/example.com\/password\/reset",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauth": 1,
        "mail_smtpport": "587",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauthtype": "LOGIN",
        "loglevel": 2,
        "maintenance": false,
        "mail_smtpsecure": "tls",
        "updater.release.channel": "beta",
        "theme": "",
        "updater.secret": "***REMOVED SENSITIVE VALUE***"
    },
    "apps": {
        "activity": {
            "enabled": "yes",
            "installed_version": "2.5.2",
            "types": "filesystem"
        },
        "admin_audit": {
            "enabled": "yes",
            "installed_version": "1.2.0",
            "types": "logging"
        },
        "audioplayer": {
            "enabled": "no",
            "installed_version": "2.2.1",
            "types": "filesystem"
        },
        "backgroundjob": {
            "lastjob": "23"
        },
        "brookedotpub": {
            "enabled": "yes",
            "installed_version": "1.0.0",
            "types": "theme"
        },
        "bruteforcesettings": {
            "enabled": "yes",
            "installed_version": "1.0.3",
            "types": ""
        },
        "caniupdate": {
            "enabled": "[\"admin\"]",
            "installed_version": "0.1.1",
            "types": ""
        },
        "comments": {
            "enabled": "yes",
            "installed_version": "1.2.0",
            "types": "logging"
        },
        "configreport": {
            "enabled": "yes",
            "installed_version": "0.1.1",
            "types": "filesystem"
        },
        "core": {
            "backgroundjobs_mode": "cron",
            "default_encryption_module": "OC_DEFAULT_MODULE",
            "enable_external_storage": "yes",
            "encryption_enabled": "no",
            "installed.bundles": "[\"CoreBundle\"]",
            "installedat": "1511388074.0793",
            "lastcron": "1513313101",
            "lastupdateResult": "{\"version\":\"13.0.0.8\",\"versionstring\":\"Nextcloud 13.0.0 beta 3\",\"url\":\"https:\\\/\\\/download.nextcloud.com\\\/server\\\/prereleases\\\/nextcloud-13.0.0beta3.zip\",\"web\":\"https:\\\/\\\/docs.nextcloud.com\\\/server\\\/12\\\/admin_manual\\\/maintenance\\\/upgrade.html\",\"autoupdater\":\"1\",\"signature\":\"dwKkklqlJKAKIVzDiKzN2vz0uaKcnZjKtB0\\\/iluHAhi4jHmfCyrBfj0Wj5gI\\\/wWm\\nq4Kp1+YM4uEYXBjyQVUfIktQf+TW0cUJqvEctl4tcoQ7y3LJi9MNj4BaIrqncgYI\\nuW5GPsL1JxwU4up9VWTPhCYFmQx50soyjIrM13cTmmZKiFtaYYeQ5zvvPdFwGSCA\\nn9HE4SPDBvB\\\/ZjT2FBAJJcRygoGgGtltXa0canni0aYqGtUnuHFM4uBytKGuv4VB\\nDKZlWAFVTXY+Q0ZUqNa\\\/KE3pbEjXI4hHstGyb\\\/p3\\\/OtLqHYWRNC8j1vq3oiFTgBt\\nAMjyxusZNeKNOloBr1PxXw==\"}",
            "lastupdatedat": "1513314215",
            "moveavatarsdone": "yes",
            "oc.integritycheck.checker": "[]",
            "previewsCleanedUp": "1",
            "public_files": "files_sharing\/public.php",
            "public_webdav": "dav\/appinfo\/v1\/publicwebdav.php",
            "scss.variables": "09db8374fdd55a3a1cc6eb425c5bed86",
            "shareapi_allow_public_notification": "yes",
            "shareapi_allow_resharing": "yes",
            "shareapi_default_expire_date": "no",
            "shareapi_enforce_links_password": "no",
            "shareapi_exclude_groups": "no",
            "shareapi_exclude_groups_list": "[\"\"]",
            "shareapi_share_dialog_user_enumeration_group_members": "no",
            "updater.secret.created": "1513314222",
            "vendor": "nextcloud"
        },
        "dav": {
            "buildCalendarSearchIndex": "yes",
            "enabled": "yes",
            "installed_version": "1.3.0",
            "types": "filesystem"
        },
        "encryption": {
            "enabled": "no",
            "encryptHomeStorage": "1",
            "installed_version": "1.6.0",
            "masterKeyId": "master_44a2126e",
            "publicShareKeyId": "pubShare_44a2126e",
            "recoveryAdminEnabled": "1",
            "recoveryKeyId": "recoveryKey_44a2126e",
            "types": "filesystem"
        },
        "federatedfilesharing": {
            "enabled": "yes",
            "installed_version": "1.2.0",
            "types": ""
        },
        "federation": {
            "enabled": "no",
            "installed_version": "1.2.0",
            "types": "authentication"
        },
        "files": {
            "cronjob_scan_files": "500",
            "enabled": "yes",
            "installed_version": "1.7.2",
            "types": "filesystem"
        },
        "files_antivirus": {
            "av_cmd_options": "",
            "av_host": "",
            "av_infected_action": "only_log",
            "av_max_file_size": "-1",
            "av_mode": "executable",
            "av_path": "\/usr\/bin\/clamscan",
            "av_port": "0",
            "av_socket": "\/var\/run\/clamav\/clamd.ctl",
            "av_stream_max_length": "26214400",
            "enabled": "yes",
            "installed_version": "0.11.2",
            "ocsid": "157439",
            "signed": "true",
            "types": "filesystem"
        },
        "files_external": {
            "allow_user_mounting": "yes",
            "enabled": "yes",
            "installed_version": "1.3.0",
            "ocsid": "166048",
            "types": "filesystem",
            "user_mounting_backends": "owncloud,sftp,amazons3,dropbox,googledrive,\\OC\\Files\\Storage\\SFTP_Key"
        },
        "files_pdfviewer": {
            "enabled": "yes",
            "installed_version": "1.1.1",
            "ocsid": "166049",
            "types": ""
        },
        "files_sharing": {
            "enabled": "yes",
            "incoming_server2server_share_enabled": "no",
            "installed_version": "1.4.0",
            "lookupServerUploadEnabled": "no",
            "outgoing_server2server_share_enabled": "no",
            "types": "filesystem"
        },
        "files_texteditor": {
            "enabled": "yes",
            "installed_version": "2.4.1",
            "ocsid": "166051",
            "types": ""
        },
        "files_trashbin": {
            "enabled": "yes",
            "installed_version": "1.2.0",
            "types": "filesystem"
        },
        "files_versions": {
            "enabled": "yes",
            "installed_version": "1.5.0",
            "types": "filesystem"
        },
        "files_videoplayer": {
            "enabled": "no",
            "installed_version": "0.9.8",
            "types": ""
        },
        "firstrunwizard": {
            "enabled": "no",
            "installed_version": "1.1",
            "ocsid": "166055",
            "types": ""
        },
        "gallery": {
            "enabled": "yes",
            "installed_version": "17.0.0",
            "types": ""
        },
        "guests": {
            "enabled": "yes",
            "installed_version": "0.5.0",
            "signed": "true",
            "types": "authentication"
        },
        "logreader": {
            "enabled": "yes",
            "installed_version": "2.0.0",
            "ocsid": "170871",
            "types": ""
        },
        "lookup_server_connector": {
            "enabled": "yes",
            "installed_version": "1.0.0",
            "types": "authentication"
        },
        "market": {
            "enabled": "yes",
            "installed_version": "0.2.3",
            "signed": "true",
            "types": ""
        },
        "metadata": {
            "enabled": "no",
            "installed_version": "0.6.0",
            "types": ""
        },
        "nextcloud_announcements": {
            "enabled": "no",
            "installed_version": "1.1",
            "types": "logging"
        },
        "notifications": {
            "enabled": "no",
            "installed_version": "0.3.1",
            "types": "logging"
        },
        "oauth2": {
            "enabled": "yes",
            "installed_version": "1.0.5",
            "types": "authentication"
        },
        "password_policy": {
            "enabled": "yes",
            "enforceNumericCharacters": "1",
            "enforceSpecialCharacters": "1",
            "enforceUpperLowerCase": "1",
            "installed_version": "1.2.2",
            "minLength": "12",
            "types": ""
        },
        "provisioning_api": {
            "enabled": "yes",
            "installed_version": "1.2.0",
            "types": "prevent_group_restriction"
        },
        "ransomware_protection": {
            "enabled": "yes",
            "installed_version": "1.0.5",
            "notes_include_biased": "yes",
            "types": "logging"
        },
        "security": {
            "brute_force_protection_ban_period": "3600",
            "brute_force_protection_fail_tolerance": "3",
            "brute_force_protection_time_threshold": "600",
            "enabled": "yes",
            "enforce_numeric_characters": "1",
            "enforce_special_characters": "1",
            "enforce_upper_lower_case": "1",
            "installed_version": "0.0.2",
            "min_password_length": "12",
            "signed": "true",
            "types": "prelogin"
        },
        "serverinfo": {
            "enabled": "yes",
            "installed_version": "1.2.0",
            "types": ""
        },
        "sharebymail": {
            "enabled": "yes",
            "enforcePasswordProtection": "no",
            "installed_version": "1.2.0",
            "sendpasswordmail": "no",
            "types": "filesystem"
        },
        "socialsharing_email": {
            "enabled": "no",
            "installed_version": "1.0.1",
            "types": ""
        },
        "socialsharing_twitter": {
            "enabled": "yes",
            "installed_version": "1.0.2",
            "types": ""
        },
        "survey_client": {
            "enabled": "no",
            "installed_version": "1.0.0",
            "types": ""
        },
        "systemtags": {
            "enabled": "no",
            "installed_version": "0.3.0",
            "types": "logging"
        },
        "templateeditor": {
            "enabled": "no",
            "installed_version": "0.1",
            "types": ""
        },
        "theme-example": {
            "enabled": "no",
            "installed_version": "1.0.0",
            "types": "theme"
        },
        "theming": {
            "backgroundMime": "backgroundColor",
            "cachebuster": "16",
            "color": "#239ec4",
            "enabled": "yes",
            "installed_version": "1.3.0",
            "logoMime": "image\/png",
            "name": "Site.name",
            "slogan": "Proudly powered by Nextcloud",
            "types": "logging",
            "url": "https:\/\/example"
        },
        "theming_customcss": {
            "cachebuster": "151186027479",
            "customcss": "#body-login {\n\tbackground: #239ec4; \/* Old browsers *\/\n\tbackground: -moz-linear-gradient(top, #239ec4 0%, #236dc4 100%) !important; \/* FF3.6+ *\/\n\tbackground: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#239ec4), color-stop(100%,#236dc4)) !important; \/* Chrome,Safari4+ *\/\n\tbackground: -webkit-linear-gradient(top, #239ec4 0%,#236dc4 100%) !important; \/* Chrome10+,Safari5.1+ *\/\n\tbackground: -o-linear-gradient(top, #239ec4 0%,#236dc4 100%) !important; \/* Opera11.10+ *\/\n\tbackground: -ms-linear-gradient(top, #239ec4 0%,#236dc4 100%); \/* IE10+ *\/\n\tbackground: linear-gradient(top, #239ec4 0%,#236dc4 100%) !important; \/* W3C *\/\n\tfilter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#239ec4', endColorstr='#236dc4',GradientType=0 ) !important; \/* IE6-9 *\/\n}\n\/* use logos from theme *\/\n#header .logo {\n        background: url('https:\/\/brooke.pub\/apps\/theming\/logo.png');\n\tbackground-image: url('https:\/\/brooke.pub\/apps\/theming\/logo.svg');\n\twidth: 250px;\n\theight: 121px;\n}\n#header .logo-icon {\n        background: url('https:\/\/brooke.pub\/apps\/theming\/logo-icon.png');\n\tbackground-image: url('https:\/\/brooke.pub\/apps\/theming\/logo-icon.svg');\n\twidth: 238px;\n\theight: 34px;\n\tbackground-size: 238px 34px;\n}\n\n.two-factor-link .button{\n\tbackground-color: #236dc4;\n}\n\ninput[type='submit'], input[type='button'], button, .button, select{\n\tbackground-color: #239ec4;\n\tcolor:#FFFFFF;\n}\n#header.share-file h1.header-appname {\n\tdisplay: none;\n}",
            "enabled": "yes",
            "installed_version": "1.0.0",
            "types": ""
        },
        "twofactor_backupcodes": {
            "enabled": "yes",
            "installed_version": "1.1.1",
            "types": ""
        },
        "twofactor_totp": {
            "enabled": "yes",
            "installed_version": "1.3.1",
            "signed": "true",
            "types": ""
        },
        "updatenotification": {
            "enabled": "yes",
            "installed_version": "1.2.0",
            "types": "",
            "update_check_errors": "0"
        },
        "user_external": {
            "enabled": "yes",
            "installed_version": "0.4",
            "types": "authentication,prelogin"
        },
        "workflowengine": {
            "enabled": "yes",
            "installed_version": "1.2.0",
            "types": "filesystem"
        }
    }
}

Are you using external storage, if yes which one: Have 2 AWS SE storage

Are you using encryption: no

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...

Client configuration

Browser: Firefox 57.0.1

Operating system: MacOS 10.13.2

Nextcloud log (data/nextcloud.log)


{"reqId":"sixu2numKkz10drXEfAi","level":1,"time":"2017-12-15T05:08:36+00:00","remoteAddr":"","user":"--","app":"updater","method":"--","url":"--","message":"\\OC\\Repair::info: Repair info: All tables already have the correct collation -> nothing to do","userAgent":"--","version":"12.0.4.3"}
{"reqId":"sixu2numKkz10drXEfAi","level":1,"time":"2017-12-15T05:08:36+00:00","remoteAddr":"","user":"--","app":"updater","method":"--","url":"--","message":"\\OC\\Repair::step: Repair step: Repair SQLite autoincrement","userAgent":"--","version":"12.0.4.3"}
{"reqId":"sixu2numKkz10drXEfAi","level":1,"time":"2017-12-15T05:08:36+00:00","remoteAddr":"","user":"--","app":"updater","method":"--","url":"--","message":"\\OC\\Repair::step: Repair step: Copy data from accounts table when migrating from ownCloud","userAgent":"--","version":"12.0.4.3"}
{"reqId":"sixu2numKkz10drXEfAi","level":1,"time":"2017-12-15T05:08:36+00:00","remoteAddr":"","user":"--","app":"updater","method":"--","url":"--","message":"\\OC\\Repair::step: Repair step: Drop account terms table when migrating from ownCloud","userAgent":"--","version":"12.0.4.3"}
{"reqId":"sixu2numKkz10drXEfAi","level":1,"time":"2017-12-15T05:08:36+00:00","remoteAddr":"","user":"--","app":"updater","method":"--","url":"--","message":"\\OC\\Updater::dbUpgradeBefore: Updating database schema","userAgent":"--","version":"12.0.4.3"}
{"reqId":"sixu2numKkz10drXEfAi","level":3,"time":"2017-12-15T05:08:36+00:00","remoteAddr":"","user":"--","app":"core","method":"--","url":"--","message":"Exception: {\"Exception\":\"Doctrine\\\\DBAL\\\\Exception\\\\DriverException\",\"Message\":\"An exception occurred while executing 'INSERT INTO `migrations` (`app`,`version`) SELECT ?,? FROM `migrations` WHERE `app` = ? AND `version` = ? HAVING COUNT(*) = 0' with params [\\\"core\\\", \\\"13000Date20170705121758\\\", \\\"core\\\", \\\"13000Date20170705121758\\\"]:\\n\\nSQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'version' at row 1\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/DBALException.php(128): Doctrine\\\\DBAL\\\\Driver\\\\AbstractMySQLDriver->convertException('An exception oc...', Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOException))\\n#1 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Connection.php(1015): Doctrine\\\\DBAL\\\\DBALException::driverExceptionDuringQuery(Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOMySql\\\\Driver), Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOException), 'INSERT INTO `mi...', Array)\\n#2 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/DB\\\/Connection.php(216): Doctrine\\\\DBAL\\\\Connection->executeUpdate('INSERT INTO `mi...', Array, Array)\\n#3 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/DB\\\/Adapter.php(114): OC\\\\DB\\\\Connection->executeUpdate('INSERT INTO `mi...', Array)\\n#4 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/DB\\\/Connection.php(254): OC\\\\DB\\\\Adapter->insertIfNotExist('*PREFIX*migrati...', Array, Array)\\n#5 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/DB\\\/MigrationService.php(237): OC\\\\DB\\\\Connection->insertIfNotExist('*PREFIX*migrati...', Array)\\n#6 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/DB\\\/MigrationService.php(409): OC\\\\DB\\\\MigrationService->markAsExecuted('13000Date201707...')\\n#7 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/DB\\\/MigrationService.php(356): OC\\\\DB\\\\MigrationService->executeStep('13000Date201707...')\\n#8 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Updater.php(312): OC\\\\DB\\\\MigrationService->migrate()\\n#9 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Updater.php(260): OC\\\\Updater->doCoreUpgrade()\\n#10 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Updater.php(139): OC\\\\Updater->doUpgrade('13.0.0.8', '12.0.4.3')\\n#11 \\\/var\\\/www\\\/owncloud\\\/core\\\/Command\\\/Upgrade.php(270): OC\\\\Updater->upgrade()\\n#12 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/symfony\\\/console\\\/Command\\\/Command.php(264): OC\\\\Core\\\\Command\\\\Upgrade->execute(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#13 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/symfony\\\/console\\\/Application.php(874): Symfony\\\\Component\\\\Console\\\\Command\\\\Command->run(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#14 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/symfony\\\/console\\\/Application.php(228): Symfony\\\\Component\\\\Console\\\\Application->doRunCommand(Object(OC\\\\Core\\\\Command\\\\Upgrade), Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#15 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/symfony\\\/console\\\/Application.php(130): Symfony\\\\Component\\\\Console\\\\Application->doRun(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#16 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Console\\\/Application.php(173): Symfony\\\\Component\\\\Console\\\\Application->run(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#17 \\\/var\\\/www\\\/owncloud\\\/console.php(90): OC\\\\Console\\\\Application->run()\\n#18 \\\/var\\\/www\\\/owncloud\\\/occ(11): require_once('\\\/var\\\/www\\\/ownclo...')\\n#19 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Driver\\\/AbstractMySQLDriver.php\",\"Line\":115}","userAgent":"--","version":"12.0.4.3"}

{"reqId":"DeBDPEkM1MUq9XlKnTGO","level":3,"time":"2017-12-15T05:24:02+00:00","remoteAddr":"","user":"--","app":"PHP","method":"--","url":"--","message":"Undefined index: workflowengine at \/var\/www\/owncloud\/lib\/private\/AppConfig.php#296","userAgent":"--","version":"12.0.4.3"}
{"reqId":"DeBDPEkM1MUq9XlKnTGO","level":3,"time":"2017-12-15T05:24:02+00:00","remoteAddr":"","user":"--","app":"PHP","method":"--","url":"--","message":"Invalid argument supplied for foreach() at \/var\/www\/owncloud\/lib\/private\/AppConfig.php#296","userAgent":"--","version":"12.0.4.3"}
bug owncloud migration high

Most helpful comment

@MorrisJobke Glad we were able to get to the bottom of that. It's perhaps a super power of mine to find these edge cases in OSS ;)

Just for clarity here, it seems to be the version table being set to varchar(14) was the blocker. Sounds like the plan is to make both app and version varchar(255) to match that of a standard Nextcloud install so it won't matter, just wanted to clarify that my app table is still varchar(177) and the upgrade to 13 Beta 3 seem to upgrade correctly.

All 12 comments

I was able to resolve this by updating the length of the migrations column.

SHOW COLUMNS From `migrations`;
+---------+--------------+------+-----+---------+-------+
| Field   | Type         | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+-------+
| app     | varchar(177) | NO   | PRI | NULL    |       |
| version | varchar(14)  | NO   | PRI | NULL    |       |
+---------+--------------+------+-----+---------+-------+
2 rows in set (0.01 sec)

I ran
ALTER TABLE `migrations` MODIFY `version` varchar(255);

SHOW COLUMNS From `migrations`;
+---------+--------------+------+-----+---------+-------+
| Field   | Type         | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+-------+
| app     | varchar(177) | NO   | PRI | NULL    |       |
| version | varchar(255) | NO   | PRI | NULL    |       |
+---------+--------------+------+-----+---------+-------+
2 rows in set (0.00 sec)

Then the upgrade script ran as expected.

I just tested this and it works fine (on multiple instances):

mysql> SHOW COLUMNS From `oc_migrations`;
+---------+--------------+------+-----+---------+-------+
| Field   | Type         | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+-------+
| app     | varchar(255) | NO   | PRI | NULL    |       |
| version | varchar(255) | NO   | PRI | NULL    |       |
+---------+--------------+------+-----+---------+-------+
2 rows in set (0.00 sec)

Could it be that you migrated before from ownCloud?

Could it be that you migrated before from ownCloud?

Yeah bet that's it. I originally installed ownCloud 10.0.3.3 then migrated to Nextcloud 12.0.4 RC before upgrading to the final 12.0.4 release. I manually installed the files then ran the migration script from the server.

Then today testing Nextcloud 13 Beta. So perhaps this is a bug more in the migration script of ownCloud > Nextcloud and less of Nextcloud 12 > 13 that I'm just now running into.

Here's the version line in ownCloud showing a length of 14:
https://github.com/owncloud/core/blob/master/lib/private/DB/MigrationService.php#L126

I'm not familiar enough with how the Nextcloud migration script works to check if this is indeed a problem with the version row not getting updated to 255 upon migration.

@rullzer @blizzz Do you have an idea how to handle this special case for the OC -> NC migration? We basically need to add a alter table for the migration table.

@BandonRandon Thanks for the clarification: yes this is indeed the problem. There is the 177 characters limit.

@MorrisJobke Glad we were able to get to the bottom of that. It's perhaps a super power of mine to find these edge cases in OSS ;)

Just for clarity here, it seems to be the version table being set to varchar(14) was the blocker. Sounds like the plan is to make both app and version varchar(255) to match that of a standard Nextcloud install so it won't matter, just wanted to clarify that my app table is still varchar(177) and the upgrade to 13 Beta 3 seem to upgrade correctly.

I never looked into migrations (yet).

I shall have a look at this.

I will mostlikely cover this by #5901 (that is currently the only point it mentions)

I ran
sudo -u nginx ./occ upgrade
It refer to
"An exception occurred while executing 'ALTER TABLE oc_activity CONVERT TO CHARACTER SET utf8mb4 COLLATE

utf8mb4_bin;':SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes"

What can I do?

Was this page helpful?
0 / 5 - 0 ratings