Changing database from sqlite to mariadb failed

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:

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

… 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