From 6e585325033d7ce1937748259355f73f27a1ce86 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Sat, 16 Jul 2022 10:33:07 -0700 Subject: [PATCH] Remove getDefaultSchemaName() --- UPGRADE.md | 5 +++-- psalm.xml.dist | 1 - src/Platforms/AbstractPlatform.php | 12 ------------ src/Platforms/PostgreSQLPlatform.php | 16 ---------------- src/Platforms/SQLServerPlatform.php | 16 ---------------- .../Schema/SchemaManagerFunctionalTestCase.php | 15 +++++++++++---- 6 files changed, 14 insertions(+), 51 deletions(-) diff --git a/UPGRADE.md b/UPGRADE.md index 3a6902fbfab..0a76550fea8 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -10,8 +10,9 @@ awareness about deprecated code. ## BC BREAK: removed `AbstractPlatform` methods. -1. `getIdentitySequenceName()`, -2. `usesSequenceEmulatedIdentityColumns()`. +1. `getDefaultSchemaName()`, +2. `getIdentitySequenceName()`, +3. `usesSequenceEmulatedIdentityColumns()`. ## BC BREAK: removed support for the `NULL` value of schema asset filter. diff --git a/psalm.xml.dist b/psalm.xml.dist index 748d011ddcb..549eb873521 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -47,7 +47,6 @@ - diff --git a/src/Platforms/AbstractPlatform.php b/src/Platforms/AbstractPlatform.php index c77b635adea..0bb36f4b1df 100644 --- a/src/Platforms/AbstractPlatform.php +++ b/src/Platforms/AbstractPlatform.php @@ -2222,18 +2222,6 @@ public function supportsSchemas(): bool return false; } - /** - * Returns the default schema name. - * - * @deprecated - * - * @throws Exception If not supported on this platform. - */ - public function getDefaultSchemaName(): string - { - throw NotSupported::new(__METHOD__); - } - /** * Whether this platform supports create database. * diff --git a/src/Platforms/PostgreSQLPlatform.php b/src/Platforms/PostgreSQLPlatform.php index b6b964c873a..942542f755c 100644 --- a/src/Platforms/PostgreSQLPlatform.php +++ b/src/Platforms/PostgreSQLPlatform.php @@ -16,7 +16,6 @@ use Doctrine\DBAL\Schema\TableDiff; use Doctrine\DBAL\Types\BinaryType; use Doctrine\DBAL\Types\BlobType; -use Doctrine\Deprecations\Deprecation; use UnexpectedValueException; use function array_diff; @@ -125,21 +124,6 @@ public function supportsSchemas(): bool return true; } - /** - * @deprecated - */ - public function getDefaultSchemaName(): string - { - Deprecation::trigger( - 'doctrine/dbal', - 'https://github.com/doctrine/dbal/pull/5513', - '%s is deprecated.', - __METHOD__ - ); - - return 'public'; - } - public function supportsIdentityColumns(): bool { return true; diff --git a/src/Platforms/SQLServerPlatform.php b/src/Platforms/SQLServerPlatform.php index f6dd6c5747e..e62d832b2ee 100644 --- a/src/Platforms/SQLServerPlatform.php +++ b/src/Platforms/SQLServerPlatform.php @@ -17,7 +17,6 @@ use Doctrine\DBAL\Schema\Sequence; use Doctrine\DBAL\Schema\SQLServerSchemaManager; use Doctrine\DBAL\Schema\TableDiff; -use Doctrine\Deprecations\Deprecation; use InvalidArgumentException; use function array_merge; @@ -109,21 +108,6 @@ public function supportsSchemas(): bool return true; } - /** - * @deprecated - */ - public function getDefaultSchemaName(): string - { - Deprecation::trigger( - 'doctrine/dbal', - 'https://github.com/doctrine/dbal/pull/5513', - '%s is deprecated.', - __METHOD__ - ); - - return 'dbo'; - } - public function supportsColumnCollation(): bool { return true; diff --git a/tests/Functional/Schema/SchemaManagerFunctionalTestCase.php b/tests/Functional/Schema/SchemaManagerFunctionalTestCase.php index fa84613c888..f0870397807 100644 --- a/tests/Functional/Schema/SchemaManagerFunctionalTestCase.php +++ b/tests/Functional/Schema/SchemaManagerFunctionalTestCase.php @@ -10,7 +10,9 @@ use Doctrine\DBAL\Exception\DatabaseObjectNotFoundException; use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Platforms\OraclePlatform; +use Doctrine\DBAL\Platforms\PostgreSQLPlatform; use Doctrine\DBAL\Platforms\SqlitePlatform; +use Doctrine\DBAL\Platforms\SQLServerPlatform; use Doctrine\DBAL\Schema\AbstractAsset; use Doctrine\DBAL\Schema\AbstractSchemaManager; use Doctrine\DBAL\Schema\Column; @@ -1055,13 +1057,18 @@ protected function assertVarBinaryColumnIsValid(Table $table, string $columnName public function testListTableDetailsWithFullQualifiedTableName(): void { - if (! $this->connection->getDatabasePlatform()->supportsSchemas()) { + $platform = $this->connection->getDatabasePlatform(); + + if ($platform instanceof PostgreSQLPlatform) { + $defaultSchemaName = 'public'; + } elseif ($platform instanceof SQLServerPlatform) { + $defaultSchemaName = 'pdo'; + } else { self::markTestSkipped('Test only works on platforms that support schemas.'); } - $defaultSchemaName = $this->connection->getDatabasePlatform()->getDefaultSchemaName(); - $primaryTableName = 'primary_table'; - $foreignTableName = 'foreign_table'; + $primaryTableName = 'primary_table'; + $foreignTableName = 'foreign_table'; $table = new Table($foreignTableName); $table->addColumn('id', 'integer', ['autoincrement' => true]);