Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter out tables that does not belong to Nextcloud #25882

Merged
merged 1 commit into from
Mar 3, 2021

Conversation

kesselb
Copy link
Contributor

@kesselb kesselb commented Mar 2, 2021

Fix #25748

Some people run into Unknown database type enum requested, Doctrine\\DBAL\\Platforms\\MariaDb1027Platform may not support it. on upgrade to 21. Yet we are not using enums in Nextcloud. But phpmyadmin does and some have tables by phpMyAdmin in their Nextcloud database.

Turns out our filter for the database tables does not work.

How to test:

Index: core/Command/Maintenance/Repair.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/core/Command/Maintenance/Repair.php b/core/Command/Maintenance/Repair.php
--- a/core/Command/Maintenance/Repair.php	(revision fc6b5a25f0233f7de3e46a546f4604a5b19df4f0)
+++ b/core/Command/Maintenance/Repair.php	(date 1614700816722)
@@ -86,6 +86,8 @@
 			$repairSteps = array_merge($repairSteps, $this->repair::getExpensiveRepairSteps());
 		}
 
+		$repairSteps = $this->repair::getBeforeUpgradeRepairSteps();
+
 		foreach ($repairSteps as $step) {
 			$this->repair->addStep($step);
 		}
  • Create a table testtest in your Nextcloud database
  • Patch occ maintenance:repair like above
  • Set a breakpoint lib/private/DB/Migrator.createSchema
  • Run occ maintenance:repair

@j-ed
Copy link
Contributor

j-ed commented Mar 2, 2021

Remove tables without oc_ prefix

@kesselb What does this in detail mean? Historically it was possible to use a custom database table prefix. I've e.g. set "'dbtableprefix' => 'nc_'," in the configuration file. Will all these tables now be deleted by Nextcloud?

@kesselb kesselb changed the title Remove tables without oc_ prefix Filter out tables that does not belong to Nextcloud Mar 2, 2021
@kesselb
Copy link
Contributor Author

kesselb commented Mar 2, 2021

@j-ed updated the pr title ;)

Nextcloud 21 the function to read all tables from a database returns all tables in a database.
Nextcloud 20 and below returns all tables in a database starting with dbtableprefix.

After this patch Nextcloud 21 also filters the database tables like Nextcloud 20.

@kesselb kesselb added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Mar 2, 2021
Copy link
Member

@rullzer rullzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐘

@kesselb kesselb force-pushed the bug/25748/filter-other-tables branch from fc6b5a2 to ad001f0 Compare March 2, 2021 20:08
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
@kesselb kesselb force-pushed the bug/25748/filter-other-tables branch from ad001f0 to bc91eb7 Compare March 2, 2021 20:09
@rullzer rullzer merged commit 74f3617 into master Mar 3, 2021
@rullzer rullzer deleted the bug/25748/filter-other-tables branch March 3, 2021 10:24
@kesselb
Copy link
Contributor Author

kesselb commented Mar 3, 2021

/backport to stable21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[NC 21]: Error upgrading with foreign tables in NC database
4 participants