Hello,
I tried changing the Database of my Nextcloud running in docker from SQLite to MariaDB but faced an error when executing “sudo docker exec -it -u www-data nextcloud php occ db:convert-type --all-apps mariadb nc 127.0.0.1 ncmariadb”
error:
"In ConvertType.php line 183:
This command is temporarily disabled (until the next maintenance release).
db:convert-type [–port PORT] [–password PASSWORD] [–clear-schema] [–all-apps] [–chunk-size CHUNK-SIZE] [–] "
Is there some way to do this anyways?
2 Likes
Same here, waiting for some help.
We can track the problem here:
opened 05:18PM - 10 May 24 UTC
bug
1. to develop
high
feature: install and update
regression
29-feedback
### ⚠️ This issue respects the following points: ⚠️
- [X] This is a **bug**, no… t a question or a configuration/webserver/proxy issue.
- [X] This issue is **not** already reported on [Github](https://github.com/nextcloud/server/issues?q=is%3Aopen+is%3Aissue+label%3Abug) OR [Nextcloud Community Forum](https://help.nextcloud.com/) _(I've searched it)_.
- [X] Nextcloud Server **is** up to date. See [Maintenance and Release Schedule](https://github.com/nextcloud/server/wiki/Maintenance-and-Release-Schedule) for supported versions.
- [X] I agree to follow Nextcloud's [Code of Conduct](https://nextcloud.com/contribute/code-of-conduct/).
### Bug description
The OCC-Command `db:convert-type` seems to ignore the DB properties (type, user, host, database, port, password) provided through the CLI and instead operates on the database configured in `config.php`
I believe this may be related to the commit 79c4986 as this reworked the parameter handling in `ConnectionFactory.php`.
If I read this correctly, the default parameters are now always generated based on the system config instead of the passed arguments.
Running `db:convert-type --clean-schema` drops the tables in the "old" database.
### Steps to reproduce
1. Have Nextcloud 29.0.0 running with a MySQL database, and an empty PostgreSQL database
2. run `php occ db:convert-type --password=<PASSWORD> --port=5432 pgsql nextcloud_app postgres nextcloud` (note: the host `postgres` is a Kubernetes service name)
3. The command executes no matter if the Postgres Database is running or not, the command throws Constraint Violation errors in the table `oc_accounts`, I assume because it tries to migrate the content of the old database into itself.
### Expected behavior
`db:convert-type`
### Installation method
Community Docker image
### Nextcloud Server version
29
### Operating system
Debian/Ubuntu
### PHP engine version
None
### Web server
None
### Database engine version
MySQL
### Is this bug present after an update or on a fresh install?
None
### Are you using the Nextcloud Server Encryption module?
None
### What user-backends are you using?
- [X] Default user-backend _(database)_
- [ ] LDAP/ Active Directory
- [ ] SSO - SAML
- [ ] Other
### Configuration report
```shell
{
"system": {
"htaccess.RewriteBase": "\/",
"memcache.local": "\\OC\\Memcache\\APCu",
"apps_paths": [
{
"path": "\/var\/www\/html\/apps",
"url": "\/apps",
"writable": false
},
{
"path": "\/var\/www\/html\/custom_apps",
"url": "\/custom_apps",
"writable": true
}
],
"instanceid": "***REMOVED SENSITIVE VALUE***",
"passwordsalt": "***REMOVED SENSITIVE VALUE***",
"secret": "***REMOVED SENSITIVE VALUE***",
"trusted_domains": [
"192.168.178.32",
"cloud.awae.ch"
],
"trusted_proxies": "***REMOVED SENSITIVE VALUE***",
"datadirectory": "***REMOVED SENSITIVE VALUE***",
"dbtype": "mysql",
"version": "29.0.0.19",
"overwrite.cli.url": "https:\/\/cloud.awae.ch",
"dbname": "***REMOVED SENSITIVE VALUE***",
"dbhost": "***REMOVED SENSITIVE VALUE***",
"dbport": "",
"dbtableprefix": "oc_",
"mysql.utf8mb4": true,
"dbuser": "***REMOVED SENSITIVE VALUE***",
"dbpassword": "***REMOVED SENSITIVE VALUE***",
"installed": true,
"overwriteprotocol": "https",
"theme": "",
"loglevel": 2,
"maintenance": false,
"mail_smtpmode": "smtp",
"mail_sendmailmode": "smtp",
"mail_smtpauth": 1,
"mail_smtpauthtype": "LOGIN",
"mail_smtphost": "***REMOVED SENSITIVE VALUE***",
"mail_smtpport": "25",
"mail_from_address": "***REMOVED SENSITIVE VALUE***",
"mail_domain": "***REMOVED SENSITIVE VALUE***",
"mail_smtpname": "***REMOVED SENSITIVE VALUE***",
"mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
"mail_smtpsecure": "tls",
"default_language": "de",
"default_phone_region": "CH",
"app_install_overwrite": [
"polls"
]
}
}
```
### List of activated Apps
```shell
Enabled:
- activity: 2.21.1
- circles: 29.0.0-dev
- cloud_federation_api: 1.12.0
- comments: 1.19.0
- contactsinteraction: 1.10.0
- dashboard: 7.9.0
- dav: 1.30.1
- federatedfilesharing: 1.19.0
- federation: 1.19.0
- files: 2.1.0
- files_downloadlimit: 2.0.0
- files_pdfviewer: 2.10.0
- files_reminders: 1.2.0
- files_sharing: 1.21.0
- files_trashbin: 1.19.0
- files_versions: 1.22.0
- firstrunwizard: 2.18.0
- logreader: 2.14.0
- lookup_server_connector: 1.17.0
- nextcloud_announcements: 1.18.0
- notes: 4.10.0
- notifications: 2.17.0
- oauth2: 1.17.0
- password_policy: 1.19.0
- photos: 2.5.0
- polls: 7.0.3
- privacy: 1.13.0
- provisioning_api: 1.19.0
- recommendations: 2.1.0
- related_resources: 1.4.0
- serverinfo: 1.19.0
- settings: 1.12.0
- sharebymail: 1.19.0
- support: 1.12.0
- survey_client: 1.17.0
- systemtags: 1.19.0
- text: 3.10.0
- theming: 2.4.0
- twofactor_backupcodes: 1.18.0
- updatenotification: 1.19.1
- viewer: 2.3.0
- workflowengine: 2.11.0
Disabled:
- admin_audit: 1.19.0
- bruteforcesettings: 2.9.0 (installed 2.4.0)
- encryption: 2.17.0
- extract: 1.3.6 (installed 1.3.6)
- files_external: 1.21.0
- files_rightclick: 0.15.1 (installed 1.6.0)
- maps: 1.1.0 (installed 1.1.0)
- suspicious_login: 7.0.0
- twofactor_totp: 11.0.0-dev
- user_ldap: 1.20.0
- user_status: 1.9.0 (installed 1.4.0)
- weather_status: 1.9.0 (installed 1.4.0)
```
### Nextcloud Signing status
```shell
No errors have been found.
```
### Nextcloud Logs
_No response_
### Additional info
* Docker Image: `nextcloud:29.0.0`
* MySQL Database: `mysql:8.4.0`
* Postgres Databse: `postgres:16.3`
1 Like
It seems that it is solved by #46931 .
1 Like
I just upgraded to 29.0.6, and the issue is still happening.
Just updated to 30.0.0, and the same error message is coming up when I try to convert the database to mySQL.
1 Like
Still happening under Nextcloud Hub 9 (30.0.1)
1 Like
I am also hitting this same problem, any update on this long standing issue please?
Still happening with Nextcloud Hub 9 (30.0.1)
I need to chaneg my db, because the old one is doing to much troubles…
Please fix this or maybe an alternative way?
I tried it manually but that is not working.
Thank you
usrflo
November 8, 2024, 8:57pm
10
… and still happening with Nextcloud Hub 9 (30.0.2).
As a workaround I first checked the issue at fix(db): Prevent data loss by temporarily disabling `db:convert-type` · nextcloud/server@59dc6b4 · GitHub with the related bug. And patched 2 nextcloud files according to [Bug]: `occ db:convert-type` broken since `PrimaryReadReplicaConnection` support added · Issue #45257 · nextcloud/server · GitHub :
# diff lib/private/DB/ConnectionFactory.orig.php lib/private/DB/ConnectionFactory.php
111c111
< $connectionParams = $this->createConnectionParams('', $additionalConnectionParams);
---
> $connectionParams = $this->createConnectionParams('', $additionalConnectionParams, $type);
182,183c182,185
< public function createConnectionParams(string $configPrefix = '', array $additionalConnectionParams = []) {
< $type = $this->config->getValue('dbtype', 'sqlite');
---
> public function createConnectionParams(string $configPrefix = '', array $additionalConnectionParams = [], $type = '') {
> if ($type === '') {
> $type = $this->config->getValue('dbtype', 'sqlite');
> }
215c217
< if ($this->config->getValue('mysql.utf8mb4', false)) {
---
> if ($this->config->getValue('mysql.utf8mb4', false) && $type==="mysql") {
# diff core/Command/Db/ConvertType.orig.php core/Command/Db/ConvertType.php
158,160c158,160
< throw new \InvalidArgumentException(
< 'This command is temporarily disabled (until the next maintenance release).'
< );
---
> // throw new \InvalidArgumentException(
> // 'This command is temporarily disabled (until the next maintenance release).'
> // );
229c229
< $connectionParams = $this->connectionFactory->createConnectionParams();
---
> $connectionParams = $this->connectionFactory->createConnectionParams('', [], $type);
Then I installed postgresql with an empty database as I wanted to move from MariaDB to PostgreSQL:
apt install -y php8.3-pgsql postgresql
sudo -u postgres psql
# DROP DATABASE nextcloud;
# DROP USER nextcloud;
CREATE USER nextcloud WITH PASSWORD 'nextcloud';
CREATE DATABASE nextcloud TEMPLATE template0 ENCODING 'UNICODE';
ALTER DATABASE nextcloud OWNER TO nextcloud;
GRANT ALL PRIVILEGES ON DATABASE nextcloud TO nextcloud;
Conversion from MariaDB to PostgreSQL finally.
If this step fails for some db table corruption: fix the problem and repeat the last step with “DROP DATABASSE nextcloud; …”
# sudo -u www-data php --define apc.enable_cli=1 /var/www/nextcloud/occ maintenance:mode --off
sudo -u www-data php --define apc.enable_cli=1 /var/www/nextcloud/occ db:convert-type --password="nextcloud" --port=5432 pgsql nextcloud 127.0.0.1 nextcloud