Skip to content

Commit

Permalink
Merge pull request #5289 from morozov/issues/5284-remove-schema-manag…
Browse files Browse the repository at this point in the history
…er-database

Remove $database from AbstractSchemaManager::list*() methods
  • Loading branch information
morozov authored Feb 19, 2022
2 parents 863b94d + 3b7b3ef commit 9ca8551
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 33 deletions.
8 changes: 8 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ awareness about deprecated code.

# Upgrade to 4.0

## Removed support for the `$database` parameter of `AbstractSchemaManager::list*()` methods

Passing `$database` to the following methods is no longer supported:

- `AbstractSchemaManager::listSequences()`,
- `AbstractSchemaManager::listTableColumns()`,
- `AbstractSchemaManager::listTableForeignKeys()`.

## Removed `AbstractPlatform` schema introspection methods

The following schema introspection methods have been removed:
Expand Down
39 changes: 7 additions & 32 deletions src/Schema/AbstractSchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\Exception\NotSupported;
use Doctrine\DBAL\Result;
use Doctrine\Deprecations\Deprecation;

use function array_filter;
use function array_intersect;
Expand Down Expand Up @@ -98,17 +97,9 @@ public function listSchemaNames(): array
*
* @throws Exception
*/
public function listSequences(?string $database = null): array
public function listSequences(): array
{
if ($database === null) {
$database = $this->getDatabase(__METHOD__);
} else {
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/issues/5284',
'Passing $database to AbstractSchemaManager::listSequences() is deprecated.'
);
}
$database = $this->getDatabase(__METHOD__);

$sql = $this->_platform->getListSequencesSQL($database);

Expand All @@ -131,17 +122,9 @@ public function listSequences(?string $database = null): array
*
* @throws Exception
*/
public function listTableColumns(string $table, ?string $database = null): array
public function listTableColumns(string $table): array
{
if ($database === null) {
$database = $this->getDatabase(__METHOD__);
} else {
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/issues/5284',
'Passing $database to AbstractSchemaManager::listTableColumns() is deprecated.'
);
}
$database = $this->getDatabase(__METHOD__);

return $this->_getPortableTableColumnList(
$table,
Expand Down Expand Up @@ -292,7 +275,7 @@ public function listTableDetails(string $name): Table

return new Table(
$name,
$this->listTableColumns($name, $database),
$this->listTableColumns($name),
$this->listTableIndexes($name),
[],
$foreignKeys,
Expand Down Expand Up @@ -368,17 +351,9 @@ public function listViews(): array
*
* @throws Exception
*/
public function listTableForeignKeys(string $table, ?string $database = null): array
public function listTableForeignKeys(string $table): array
{
if ($database === null) {
$database = $this->getDatabase(__METHOD__);
} else {
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/issues/5284',
'Passing $database to AbstractSchemaManager::listTableForeignKeys() is deprecated.'
);
}
$database = $this->getDatabase(__METHOD__);

return $this->_getPortableTableForeignKeysList(
$this->selectDatabaseForeignKeys(
Expand Down
2 changes: 1 addition & 1 deletion src/Schema/SqliteSchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function dropForeignKey(string $name, string $table): void
/**
* {@inheritdoc}
*/
public function listTableForeignKeys(string $table, ?string $database = null): array
public function listTableForeignKeys(string $table): array
{
$tableForeignKeys = $this->selectDatabaseForeignKeys('', $this->normalizeName($table))
->fetchAllAssociative();
Expand Down

0 comments on commit 9ca8551

Please sign in to comment.