From 287d5271e0eed4327f8ef189bea016d7bf092781 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 1 Jul 2024 11:17:38 +0200 Subject: [PATCH] fix(db)!: `Doctrine\DBAL\Connection::getSchemaManager` was removed, use `Connection::createSchemaManager` instead Signed-off-by: Joas Schilling --- core/Command/Db/ConvertType.php | 4 ++-- lib/private/DB/Connection.php | 2 +- lib/private/DB/OracleConnection.php | 4 ++-- lib/private/DB/PgSqlTools.php | 2 +- tests/lib/Repair/RepairCollationTest.php | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/Command/Db/ConvertType.php b/core/Command/Db/ConvertType.php index bba20220a3d..961f294e40e 100644 --- a/core/Command/Db/ConvertType.php +++ b/core/Command/Db/ConvertType.php @@ -245,7 +245,7 @@ class ConvertType extends Command implements CompletionAwareInterface { $output->writeln('Clearing schema in new database'); } foreach ($toTables as $table) { - $db->getSchemaManager()->dropTable($table); + $db->createSchemaManager()->dropTable($table); } } @@ -258,7 +258,7 @@ class ConvertType extends Command implements CompletionAwareInterface { } return preg_match($filterExpression, $asset) !== false; }); - return $db->getSchemaManager()->listTableNames(); + return $db->createSchemaManager()->listTableNames(); } /** diff --git a/lib/private/DB/Connection.php b/lib/private/DB/Connection.php index 92ed44e6062..365ef75dc3d 100644 --- a/lib/private/DB/Connection.php +++ b/lib/private/DB/Connection.php @@ -548,7 +548,7 @@ class Connection extends PrimaryReadReplicaConnection { */ public function dropTable($table) { $table = $this->tablePrefix . trim($table); - $schema = $this->getSchemaManager(); + $schema = $this->createSchemaManager(); if ($schema->tablesExist([$table])) { $schema->dropTable($table); } diff --git a/lib/private/DB/OracleConnection.php b/lib/private/DB/OracleConnection.php index abfb69f129b..5ffb65d801d 100644 --- a/lib/private/DB/OracleConnection.php +++ b/lib/private/DB/OracleConnection.php @@ -68,7 +68,7 @@ class OracleConnection extends Connection { public function dropTable($table) { $table = $this->tablePrefix . trim($table); $table = $this->quoteIdentifier($table); - $schema = $this->getSchemaManager(); + $schema = $this->createSchemaManager(); if ($schema->tablesExist([$table])) { $schema->dropTable($table); } @@ -83,7 +83,7 @@ class OracleConnection extends Connection { public function tableExists($table) { $table = $this->tablePrefix . trim($table); $table = $this->quoteIdentifier($table); - $schema = $this->getSchemaManager(); + $schema = $this->createSchemaManager(); return $schema->tablesExist([$table]); } } diff --git a/lib/private/DB/PgSqlTools.php b/lib/private/DB/PgSqlTools.php index 35e8016191c..d529cb26b09 100644 --- a/lib/private/DB/PgSqlTools.php +++ b/lib/private/DB/PgSqlTools.php @@ -43,7 +43,7 @@ class PgSqlTools { return preg_match($filterExpression, $asset) !== false; }); - foreach ($conn->getSchemaManager()->listSequences() as $sequence) { + foreach ($conn->createSchemaManager()->listSequences() as $sequence) { $sequenceName = $sequence->getName(); $sqlInfo = 'SELECT table_schema, table_name, column_name FROM information_schema.columns diff --git a/tests/lib/Repair/RepairCollationTest.php b/tests/lib/Repair/RepairCollationTest.php index 55bda8337c9..5f5e0737f77 100644 --- a/tests/lib/Repair/RepairCollationTest.php +++ b/tests/lib/Repair/RepairCollationTest.php @@ -73,7 +73,7 @@ class RepairCollationTest extends TestCase { } protected function tearDown(): void { - $this->connection->getInner()->getSchemaManager()->dropTable($this->tableName); + $this->connection->getInner()->createSchemaManager()->dropTable($this->tableName); parent::tearDown(); }