aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/DB/SchemaWrapper.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/DB/SchemaWrapper.php')
-rw-r--r--lib/private/DB/SchemaWrapper.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/private/DB/SchemaWrapper.php b/lib/private/DB/SchemaWrapper.php
index 8ff952b8710..0d5b2040513 100644
--- a/lib/private/DB/SchemaWrapper.php
+++ b/lib/private/DB/SchemaWrapper.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@@ -20,9 +21,13 @@ class SchemaWrapper implements ISchemaWrapper {
/** @var array */
protected $tablesToDelete = [];
- public function __construct(Connection $connection) {
+ public function __construct(Connection $connection, ?Schema $schema = null) {
$this->connection = $connection;
- $this->schema = $this->connection->createSchema();
+ if ($schema) {
+ $this->schema = $schema;
+ } else {
+ $this->schema = $this->connection->createSchema();
+ }
}
public function getWrappedSchema() {
@@ -32,6 +37,9 @@ class SchemaWrapper implements ISchemaWrapper {
public function performDropTableCalls() {
foreach ($this->tablesToDelete as $tableName => $true) {
$this->connection->dropTable($tableName);
+ foreach ($this->connection->getShardConnections() as $shardConnection) {
+ $shardConnection->dropTable($tableName);
+ }
unset($this->tablesToDelete[$tableName]);
}
}