Skip to content

Commit

Permalink
Merge pull request #5515 from morozov/remove-deprecated
Browse files Browse the repository at this point in the history
Remove the APIs deprecated in DBAL 3.x
  • Loading branch information
morozov authored Jul 17, 2022
2 parents 8d74be5 + ac58f35 commit 77f0aff
Show file tree
Hide file tree
Showing 16 changed files with 51 additions and 369 deletions.
12 changes: 12 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ awareness about deprecated code.

# Upgrade to 4.0

## BC BREAK: removed `SqlitePlatform` methods.

1. `getTinyIntTypeDeclarationSQL()`,
2. `getMediumIntTypeDeclarationSQL()`.

## BC BREAK: removed `AbstractPlatform` methods.

1. `getDefaultSchemaName()`,
2. `getIdentitySequenceName()`,
3. `supportsCreateDropDatabase()`,
4. `usesSequenceEmulatedIdentityColumns()`.

## BC BREAK: removed support for the `NULL` value of schema asset filter.

The argument of `Configuration::setSchemaAssetsFilter()` is now required and non-nullable.
Expand Down
16 changes: 0 additions & 16 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,6 @@
See https://github.com/doctrine/dbal/pull/4317
-->
<file name="tests/Functional/LegacyAPITest.php"/>
<!--
TODO: remove in 4.0.0
-->
<referencedMethod name="Doctrine\DBAL\Platforms\SqlitePlatform::getTinyIntTypeDeclarationSQL"/>
<referencedMethod name="Doctrine\DBAL\Platforms\SqlitePlatform::getMediumIntTypeDeclarationSQL"/>
<!--
TODO: remove in 4.0.0
-->
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractPlatform::getDefaultSchemaName"/>
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractPlatform::getIdentitySequenceName"/>
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractPlatform::supportsCreateDropDatabase"/>
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractPlatform::usesSequenceEmulatedIdentityColumns"/>
<referencedMethod name="Doctrine\DBAL\Platforms\DB2Platform::supportsCreateDropDatabase"/>
<referencedMethod name="Doctrine\DBAL\Platforms\OraclePlatform::usesSequenceEmulatedIdentityColumns"/>
<referencedMethod name="Doctrine\DBAL\Platforms\PostgreSQLPlatform::getIdentitySequenceName"/>
<referencedMethod name="Doctrine\DBAL\Platforms\PostgreSQLPlatform::usesSequenceEmulatedIdentityColumns"/>
</errorLevel>
</DeprecatedMethod>
<DocblockTypeContradiction>
Expand Down
75 changes: 0 additions & 75 deletions src/Platforms/AbstractPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
use Doctrine\DBAL\Types;
use Doctrine\DBAL\Types\Exception\TypeNotFound;
use Doctrine\DBAL\Types\Type;
use Doctrine\Deprecations\Deprecation;
use InvalidArgumentException;
use UnexpectedValueException;

Expand Down Expand Up @@ -2075,31 +2074,19 @@ public function getSequenceNextValSQL(string $sequence): string
* Returns the SQL to create a new database.
*
* @param string $name The name of the database that should be created.
*
* @throws Exception If not supported on this platform.
*/
public function getCreateDatabaseSQL(string $name): string
{
if (! $this->supportsCreateDropDatabase()) {
throw NotSupported::new(__METHOD__);
}

return 'CREATE DATABASE ' . $name;
}

/**
* Returns the SQL snippet to drop an existing database.
*
* @param string $name The name of the database that should be dropped.
*
* @throws Exception If not supported on this platform.
*/
public function getDropDatabaseSQL(string $name): string
{
if (! $this->supportsCreateDropDatabase()) {
throw NotSupported::new(__METHOD__);
}

return 'DROP DATABASE ' . $name;
}

Expand Down Expand Up @@ -2183,44 +2170,6 @@ public function supportsIdentityColumns(): bool
return false;
}

/**
* Whether the platform emulates identity columns through sequences.
*
* Some platforms that do not support identity columns natively
* but support sequences can emulate identity columns by using
* sequences.
*
* @deprecated
*/
public function usesSequenceEmulatedIdentityColumns(): bool
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5513',
'%s is deprecated.',
__METHOD__
);

return false;
}

/**
* Returns the name of the sequence for a particular identity column in a particular table.
*
* @deprecated
*
* @see usesSequenceEmulatedIdentityColumns
*
* @param string $tableName The name of the table to return the sequence name for.
* @param string $columnName The name of the identity column in the table to return the sequence name for.
*
* @throws Exception If not supported on this platform.
*/
public function getIdentitySequenceName(string $tableName, string $columnName): string
{
throw NotSupported::new(__METHOD__);
}

/**
* Whether the platform supports partial indexes.
*/
Expand Down Expand Up @@ -2261,30 +2210,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.
*
* Some databases don't allow to create and drop databases at all or only with certain tools.
*
* @deprecated
*/
public function supportsCreateDropDatabase(): bool
{
return true;
}

/**
* Whether this platform support to add inline column comments as postfix.
*/
Expand Down
16 changes: 0 additions & 16 deletions src/Platforms/DB2Platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Doctrine\DBAL\Schema\Identifier;
use Doctrine\DBAL\Schema\Index;
use Doctrine\DBAL\Schema\TableDiff;
use Doctrine\Deprecations\Deprecation;

use function array_merge;
use function count;
Expand Down Expand Up @@ -206,21 +205,6 @@ public function getListViewsSQL(string $database): string
return 'SELECT NAME, TEXT FROM SYSIBM.SYSVIEWS';
}

/**
* @deprecated
*/
public function supportsCreateDropDatabase(): bool
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5513',
'%s is deprecated.',
__METHOD__
);

return false;
}

public function supportsCommentOnStatement(): bool
{
return true;
Expand Down
27 changes: 3 additions & 24 deletions src/Platforms/OraclePlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use Doctrine\DBAL\Schema\TableDiff;
use Doctrine\DBAL\TransactionIsolationLevel;
use Doctrine\DBAL\Types\BinaryType;
use Doctrine\Deprecations\Deprecation;
use InvalidArgumentException;

use function array_merge;
Expand Down Expand Up @@ -381,8 +380,7 @@ protected function getCreateAutoincrementSql(string $name, string $table, int $s
END;";

$sequenceName = $this->getIdentitySequenceName(
$tableIdentifier->isQuoted() ? $quotedTableName : $unquotedTableName,
$nameIdentifier->isQuoted() ? $quotedName : $unquotedName
$tableIdentifier->isQuoted() ? $quotedTableName : $unquotedTableName
);
$sequence = new Sequence($sequenceName, $start);
$sql[] = $this->getCreateSequenceSQL($sequence);
Expand Down Expand Up @@ -426,8 +424,7 @@ public function getDropAutoincrementSql(string $table): array
$table = $this->normalizeIdentifier($table);
$autoincrementIdentifierName = $this->getAutoincrementIdentifierName($table);
$identitySequenceName = $this->getIdentitySequenceName(
$table->isQuoted() ? $table->getQuotedName($this) : $table->getName(),
''
$table->isQuoted() ? $table->getQuotedName($this) : $table->getName()
);

return [
Expand Down Expand Up @@ -710,25 +707,7 @@ protected function getRenameIndexSQL(string $oldIndexName, Index $index, string
return ['ALTER INDEX ' . $oldIndexName . ' RENAME TO ' . $index->getQuotedName($this)];
}

/**
* @deprecated
*/
public function usesSequenceEmulatedIdentityColumns(): bool
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5513',
'%s is deprecated.',
__METHOD__
);

return true;
}

/**
* @internal The method should be only used from within the OraclePlatform class hierarchy.
*/
public function getIdentitySequenceName(string $tableName, string $columnName): string
protected function getIdentitySequenceName(string $tableName): string
{
$table = new Identifier($tableName);

Expand Down
46 changes: 0 additions & 46 deletions src/Platforms/PostgreSQLPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -150,36 +134,6 @@ public function supportsPartialIndexes(): bool
return true;
}

/**
* @deprecated
*/
public function usesSequenceEmulatedIdentityColumns(): bool
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5513',
'%s is deprecated.',
__METHOD__
);

return true;
}

/**
* @deprecated
*/
public function getIdentitySequenceName(string $tableName, string $columnName): string
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5513',
'%s is deprecated.',
__METHOD__
);

return $tableName . '_' . $columnName . '_seq';
}

public function supportsCommentOnStatement(): bool
{
return true;
Expand Down
16 changes: 0 additions & 16 deletions src/Platforms/SQLServerPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 77f0aff

Please sign in to comment.