Ask questionsError while migrating from Owncloud 10.1.0 to Nextcloud 12.0.13
I ran into an error while attempting to migrate from Owncloud 10.1.0 to Nextcloud. I had read that the proper migration path for Owncloud 10.0.x was to migrate to Nextcloud 12.0.x, so I downloaded Nextcloud 12.0.13. Since I have backups of my data, configuration and database I attempted the migration.
I followed the manual migration instructions at: https://docs.nextcloud.com/server/15/admin_manual/maintenance/manual_upgrade.html
To start the upgrade process I first edited version.php to allow upgrading from Owncloud 10.1.0.
When I ran the upgrade command:
sudo -u www-data php occ upgrade
the upgrade fails because of this exception:
An exception occurred while executing 'DROP TABLE oc_accounts':
1217 Cannot delete or update a parent row: a foreign key constraint fails
To solve this, I needed to remove the foreign key constraints. To find all foreign keys of the oc_accounts table, I ran this query in the mysql terminal:
select
table_name,column_name,constraint_name,referenced_table_name,referenced_column_name
from
information_schema.key_column_usage
where
referenced_table_schema = 'frontier_cloud' and
referenced_table_name = 'oc_accounts';
The output was:
+---------------------+------------------+---------------------+-----------------------+------------------------+
| table_name | column_name | constraint_name | referenced_table_name | referenced_column_name |
+---------------------+------------------+---------------------+-----------------------+------------------------+
| oc_persistent_locks | owner_account_id | FK_F0C3D55BC901C6FF | oc_accounts | id |
+---------------------+------------------+---------------------+-----------------------+------------------------+
Next, I looked at the oc_persistent_locks table by doing:
show create table oc_persistent_locks
In this table there were two constraints. The first was:
CONSTRAINT `FK_F0C3D55BC901C6FF` FOREIGN KEY (`owner_account_id`) REFERENCES `oc_accounts` (`id`) ON DELETE CASCADE
To remove the constraint and key I used the following:
alter table oc_persistent_locks
drop foreign key FK_F0C3D55BC901C6FF,
drop owner_account_id;
I used the same method to remove the second constraint and key (oc_filecache). It seems this same error was detailed in this issue, which helped point me in the right direction.
After this I was able to complete the upgrade process successfully.
Operating system: Ubuntu 18.04.2
Web server: Apache2
Database: MySQL
PHP version: 7.1.26
Nextcloud version: 12.0.13
Updated from an older Nextcloud/ownCloud or fresh install: Updated from Owncloud 10.1.0
Where did you install Nextcloud from: Archive
Signing status:
Results
=======
- core
- INVALID_HASH
- version.php
I had to edit version.php to add owncloud 10.1.0 to the supported versions
List of activated apps: <details> <summary>App list</summary>
Enabled:
- bruteforcesettings: 1.3.0
- comments: 1.2.0
- dav: 1.3.1
- federatedfilesharing: 1.2.0
- federation: 1.2.0
- files: 1.7.2
- files_external: 1.3.0
- files_trashbin: 1.2.0
- files_versions: 1.5.0
- files_videoplayer: 1.1.0
- firstrunwizard: 2.1
- logreader: 2.0.0
- lookup_server_connector: 1.0.0
- nextcloud_announcements: 1.1
- notifications: 2.0.0
- oauth2: 1.0.6
- password_policy: 1.2.2
- provisioning_api: 1.2.0
- serverinfo: 1.2.0
- sharebymail: 1.2.0
- survey_client: 1.0.0
- systemtags: 1.2.0
- theming: 1.3.0
- twofactor_backupcodes: 1.1.1
- updatenotification: 1.2.0
- workflowengine: 1.2.0
Disabled:
- activity
- admin_audit
- encryption
- files_pdfviewer
- files_sharing
- files_texteditor
- gallery
- user_external
- user_ldap
</details>
Nextcloud configuration: <details> <summary>Config report</summary>
{
"system": {
"instanceid": "oc6ehmsu4frn",
"passwordsalt": "***REMOVED SENSITIVE VALUE***",
"secret": "***REMOVED SENSITIVE VALUE***",
"trusted_domains": [
"192.168.1.50",
"fsi.us.to"
],
"datadirectory": "\/data\/cloud\/",
"overwrite.cli.url": "http:\/\/fsi.us.to\/nextcloud",
"dbtype": "mysql",
"version": "12.0.13.2",
"dbname": "frontier_cloud",
"dbhost": "localhost",
"dbtableprefix": "oc_",
"dbuser": "***REMOVED SENSITIVE VALUE***",
"dbpassword": "***REMOVED SENSITIVE VALUE***",
"logtimezone": "UTC",
"installed": true,
"loglevel": 2,
"maintenance": false,
"updater.secret": "***REMOVED SENSITIVE VALUE***"
}
}
</details>
Are you using external storage, if yes which one: No
Are you using encryption: No
Are you using an external user-backend, if yes which one: No
Browser: Google Chrome Version 72.0.3626.119
Operating system: Windows 7 64-bit
Answer
questions
AlexandreBonneau
For info, following the initial post from @Addy771 (and running the additional alter table oc_persistent_locks drop foreign key FK_F0C3D55B93CB796C, drop file_id; sql statement at the end), I was able to migrate from the latest owncloud stable version 10.4.1.3 to Nextcloud 12.
Do note that you need to add the '10.4.1.3' => true, line in the owncloud array (not the nextcloud one) in version.php.
Related questions