Skip to content

Filter out tables that does not belong to Nextcloud - #25882

Merged
rullzer merged 1 commit into
masterfrom
bug/25748/filter-other-tables
Mar 3, 2021
Merged

Filter out tables that does not belong to Nextcloud#25882
rullzer merged 1 commit into
masterfrom
bug/25748/filter-other-tables

Conversation

@kesselb

@kesselbkesselb commented Mar 2, 2021

Copy link
Copy Markdown
Contributor

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

j-ed commented Mar 2, 2021

Copy link
Copy Markdown
Contributor

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?

@kesselbkesselb changed the title Remove tables without oc_ prefixFilter out tables that does not belong to NextcloudMar 2, 2021
@kesselb

Copy link
Copy Markdown
ContributorAuthor

@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.

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

@rullzerrullzer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🐘

@kesselb
kesselbforce-pushed the bug/25748/filter-other-tables branch from fc6b5a2 to ad001f0CompareMarch 2, 2021 20:08
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
@kesselb
kesselbforce-pushed the bug/25748/filter-other-tables branch from ad001f0 to bc91eb7CompareMarch 2, 2021 20:09
@rullzer
rullzer merged commit 74f3617 into masterMar 3, 2021
@rullzer
rullzer deleted the bug/25748/filter-other-tables branch March 3, 2021 10:24
@kesselb

Copy link
Copy Markdown
ContributorAuthor

/backport to stable21

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to reviewWaiting for reviewsbug

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

@kesselb@j-ed@rullzer@nickvergessen