Skip to content

Commit

Permalink
Remove PostgreSQL94Platform and SQLServer2012Platform
Browse files Browse the repository at this point in the history
  • Loading branch information
morozov committed Aug 27, 2021
1 parent cc378c3 commit 6ad8a77
Show file tree
Hide file tree
Showing 21 changed files with 42 additions and 98 deletions.
7 changes: 7 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ awareness about deprecated code.

# Upgrade to 4.0

## BC BREAK: Removed versioned platform classes that represent the lowest supported version.

The following platform-related classes have been removed:

1. `PostgreSQL94Platform` and `PostgreSQL94Keywords`.
2. `SQLServer2012Platform` and `SQLServer2012Keywords`.

## BC BREAK: Deprecated reference from `ForeignKeyConstraint` to its local (referencing) `Table`.

Reference from `ForeignKeyConstraint` to its local (referencing) `Table` is removed as well as the following methods:
Expand Down
7 changes: 0 additions & 7 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,6 @@
-->
<referencedClass name="Doctrine\DBAL\Driver\ServerInfoAwareConnection"/>
<referencedClass name="Doctrine\DBAL\VersionAwarePlatformDriver"/>
<!--
TODO: remove in 4.0.0
-->
<referencedClass name="Doctrine\DBAL\Platforms\Keywords\PostgreSQL94Keywords"/>
<referencedClass name="Doctrine\DBAL\Platforms\Keywords\SQLServer2012Keywords"/>
<referencedClass name="Doctrine\DBAL\Platforms\PostgreSQL94Platform"/>
<referencedClass name="Doctrine\DBAL\Platforms\SQLServer2012Platform"/>
</errorLevel>
</DeprecatedClass>
<DeprecatedInterface>
Expand Down
8 changes: 4 additions & 4 deletions src/Driver/AbstractPostgreSQLDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\Exception\InvalidPlatformVersion;
use Doctrine\DBAL\Platforms\PostgreSQL100Platform;
use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\PostgreSQLSchemaManager;
use Doctrine\DBAL\VersionAwarePlatformDriver;
Expand Down Expand Up @@ -42,17 +42,17 @@ public function createDatabasePlatformForVersion(string $version): AbstractPlatf
return new PostgreSQL100Platform();
}

return new PostgreSQL94Platform();
return new PostgreSQLPlatform();
}

public function getDatabasePlatform(): AbstractPlatform
{
return new PostgreSQL94Platform();
return new PostgreSQLPlatform();
}

public function getSchemaManager(Connection $conn, AbstractPlatform $platform): AbstractSchemaManager
{
assert($platform instanceof PostgreSQL94Platform);
assert($platform instanceof PostgreSQLPlatform);

return new PostgreSQLSchemaManager($conn, $platform);
}
Expand Down
6 changes: 3 additions & 3 deletions src/Driver/AbstractSQLServerDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Doctrine\DBAL\Driver\API\ExceptionConverter as ExceptionConverterInterface;
use Doctrine\DBAL\Driver\API\SQLSrv\ExceptionConverter;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\SQLServer2012Platform;
use Doctrine\DBAL\Platforms\SQLServerPlatform;
use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\SQLServerSchemaManager;

Expand All @@ -22,12 +22,12 @@ abstract class AbstractSQLServerDriver implements Driver
{
public function getDatabasePlatform(): AbstractPlatform
{
return new SQLServer2012Platform();
return new SQLServerPlatform();
}

public function getSchemaManager(Connection $conn, AbstractPlatform $platform): AbstractSchemaManager
{
assert($platform instanceof SQLServer2012Platform);
assert($platform instanceof SQLServerPlatform);

return new SQLServerSchemaManager($conn, $platform);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Platforms/Keywords/PostgreSQL100Keywords.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/**
* PostgreSQL 10.0 reserved keywords list.
*/
class PostgreSQL100Keywords extends PostgreSQL94Keywords
class PostgreSQL100Keywords extends PostgreSQLKeywords
{
public function getName(): string
{
Expand Down
14 changes: 0 additions & 14 deletions src/Platforms/Keywords/PostgreSQL94Keywords.php

This file was deleted.

14 changes: 0 additions & 14 deletions src/Platforms/Keywords/SQLServer2012Keywords.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/Platforms/PostgreSQL100Platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/**
* Provides the behavior, features and SQL dialect of the PostgreSQL 10.0 database platform.
*/
class PostgreSQL100Platform extends PostgreSQL94Platform
class PostgreSQL100Platform extends PostgreSQLPlatform
{
protected function createReservedKeywordsList(): KeywordList
{
Expand Down
14 changes: 0 additions & 14 deletions src/Platforms/PostgreSQL94Platform.php

This file was deleted.

4 changes: 2 additions & 2 deletions src/Platforms/PostgreSQLPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Doctrine\DBAL\Platforms;

use Doctrine\DBAL\Platforms\Keywords\KeywordList;
use Doctrine\DBAL\Platforms\Keywords\PostgreSQL94Keywords;
use Doctrine\DBAL\Platforms\Keywords\PostgreSQLKeywords;
use Doctrine\DBAL\Schema\ColumnDiff;
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
use Doctrine\DBAL\Schema\Identifier;
Expand Down Expand Up @@ -1014,7 +1014,7 @@ public function hasNativeJsonType(): bool

protected function createReservedKeywordsList(): KeywordList
{
return new PostgreSQL94Keywords();
return new PostgreSQLKeywords();
}

/**
Expand Down
12 changes: 0 additions & 12 deletions src/Platforms/SQLServer2012Platform.php

This file was deleted.

4 changes: 2 additions & 2 deletions src/Platforms/SQLServerPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Doctrine\DBAL\Exception\InvalidLockMode;
use Doctrine\DBAL\LockMode;
use Doctrine\DBAL\Platforms\Keywords\KeywordList;
use Doctrine\DBAL\Platforms\Keywords\SQLServer2012Keywords;
use Doctrine\DBAL\Platforms\Keywords\SQLServerKeywords;
use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\ColumnDiff;
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
Expand Down Expand Up @@ -1380,7 +1380,7 @@ public function getForUpdateSQL(): string

protected function createReservedKeywordsList(): KeywordList
{
return new SQLServer2012Keywords();
return new SQLServerKeywords();
}

public function quoteSingleIdentifier(string $str): string
Expand Down
8 changes: 4 additions & 4 deletions src/Tools/Console/Command/ReservedWordsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
use Doctrine\DBAL\Platforms\Keywords\MySQLKeywords;
use Doctrine\DBAL\Platforms\Keywords\OracleKeywords;
use Doctrine\DBAL\Platforms\Keywords\PostgreSQL100Keywords;
use Doctrine\DBAL\Platforms\Keywords\PostgreSQL94Keywords;
use Doctrine\DBAL\Platforms\Keywords\PostgreSQLKeywords;
use Doctrine\DBAL\Platforms\Keywords\ReservedKeywordsValidator;
use Doctrine\DBAL\Platforms\Keywords\SQLiteKeywords;
use Doctrine\DBAL\Platforms\Keywords\SQLServer2012Keywords;
use Doctrine\DBAL\Platforms\Keywords\SQLServerKeywords;
use Doctrine\DBAL\Tools\Console\ConnectionProvider;
use InvalidArgumentException;
use Symfony\Component\Console\Command\Command;
Expand Down Expand Up @@ -52,10 +52,10 @@ public function __construct(ConnectionProvider $connectionProvider)
'mysql57' => new MySQL57Keywords(),
'mysql80' => new MySQL80Keywords(),
'oracle' => new OracleKeywords(),
'pgsql' => new PostgreSQL94Keywords(),
'pgsql' => new PostgreSQLKeywords(),
'pgsql100' => new PostgreSQL100Keywords(),
'sqlite' => new SQLiteKeywords(),
'sqlserver' => new SQLServer2012Keywords(),
'sqlserver' => new SQLServerKeywords(),
];
}

Expand Down
9 changes: 4 additions & 5 deletions tests/Driver/AbstractPostgreSQLDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use Doctrine\DBAL\Driver\API\PostgreSQL;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\PostgreSQL100Platform;
use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\PostgreSQLSchemaManager;
Expand All @@ -28,7 +27,7 @@ protected function createDriver(): Driver

protected function createPlatform(): AbstractPlatform
{
return new PostgreSQL94Platform();
return new PostgreSQLPlatform();
}

protected function createSchemaManager(Connection $connection): AbstractSchemaManager
Expand All @@ -50,9 +49,9 @@ protected function createExceptionConverter(): ExceptionConverter
protected function getDatabasePlatformsForVersions(): array
{
return [
['9.4', PostgreSQL94Platform::class],
['9.4.0', PostgreSQL94Platform::class],
['9.4.1', PostgreSQL94Platform::class],
['9.4', PostgreSQLPlatform::class],
['9.4.0', PostgreSQLPlatform::class],
['9.4.1', PostgreSQLPlatform::class],
['10', PostgreSQL100Platform::class],
];
}
Expand Down
5 changes: 2 additions & 3 deletions tests/Driver/AbstractSQLServerDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use Doctrine\DBAL\Driver\API\ExceptionConverter as ExceptionConverterInterface;
use Doctrine\DBAL\Driver\API\SQLSrv\ExceptionConverter;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\SQLServer2012Platform;
use Doctrine\DBAL\Platforms\SQLServerPlatform;
use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\SQLServerSchemaManager;
Expand All @@ -21,7 +20,7 @@ abstract class AbstractSQLServerDriverTest extends AbstractDriverTest
{
protected function createPlatform(): AbstractPlatform
{
return new SQLServer2012Platform();
return new SQLServerPlatform();
}

protected function createSchemaManager(Connection $connection): AbstractSchemaManager
Expand All @@ -43,7 +42,7 @@ protected function createExceptionConverter(): ExceptionConverterInterface
protected function getDatabasePlatformsForVersions(): array
{
return [
['12', SQLServer2012Platform::class],
['12', SQLServerPlatform::class],
];
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Functional/Platform/ColumnTest/PostgreSQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Doctrine\DBAL\Tests\Functional\Platform\ColumnTest;

use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Tests\Functional\Platform\ColumnTest;

final class PostgreSQL extends ColumnTest
Expand All @@ -13,6 +13,6 @@ protected function setUp(): void
{
parent::setUp();

$this->requirePlatform(PostgreSQL94Platform::class);
$this->requirePlatform(PostgreSQLPlatform::class);
}
}
4 changes: 2 additions & 2 deletions tests/Functional/Platform/ColumnTest/SQLServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Doctrine\DBAL\Tests\Functional\Platform\ColumnTest;

use Doctrine\DBAL\Platforms\SQLServer2012Platform;
use Doctrine\DBAL\Platforms\SQLServerPlatform;
use Doctrine\DBAL\Tests\Functional\Platform\ColumnTest;

final class SQLServer extends ColumnTest
Expand All @@ -13,7 +13,7 @@ protected function setUp(): void
{
parent::setUp();

$this->requirePlatform(SQLServer2012Platform::class);
$this->requirePlatform(SQLServerPlatform::class);
}

public function testVariableLengthStringNoLength(): void
Expand Down
4 changes: 2 additions & 2 deletions tests/Functional/Ticket/DBAL461Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Doctrine\DBAL\Tests\Functional\Ticket;

use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Platforms\SQLServer2012Platform;
use Doctrine\DBAL\Platforms\SQLServerPlatform;
use Doctrine\DBAL\Schema\SQLServerSchemaManager;
use Doctrine\DBAL\Types\DecimalType;
use PHPUnit\Framework\TestCase;
Expand All @@ -16,7 +16,7 @@ class DBAL461Test extends TestCase
public function testIssue(): void
{
$conn = $this->createMock(Connection::class);
$platform = $this->getMockForAbstractClass(SQLServer2012Platform::class);
$platform = $this->getMockForAbstractClass(SQLServerPlatform::class);
$platform->registerDoctrineTypeMapping('numeric', 'decimal');

$schemaManager = new SQLServerSchemaManager($conn, $platform);
Expand Down
4 changes: 2 additions & 2 deletions tests/Platforms/SQLServer/ComparatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
namespace Doctrine\DBAL\Tests\Platforms\SQLServer;

use Doctrine\DBAL\Platforms\SQLServer\Comparator;
use Doctrine\DBAL\Platforms\SQLServer2012Platform;
use Doctrine\DBAL\Platforms\SQLServerPlatform;
use Doctrine\DBAL\Tests\Schema\ComparatorTest as BaseComparatorTest;

class ComparatorTest extends BaseComparatorTest
{
protected function setUp(): void
{
$this->comparator = new Comparator(new SQLServer2012Platform(), '');
$this->comparator = new Comparator(new SQLServerPlatform(), '');
}
}
4 changes: 2 additions & 2 deletions tests/Platforms/SQLServerPlatform2012Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

use Doctrine\DBAL\LockMode;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\SQLServer2012Platform;
use Doctrine\DBAL\Platforms\SQLServerPlatform;

class SQLServerPlatform2012Test extends AbstractSQLServerPlatformTestCase
{
public function createPlatform(): AbstractPlatform
{
return new SQLServer2012Platform();
return new SQLServerPlatform();
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/Schema/ColumnTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Platforms\SQLServer2012Platform;
use Doctrine\DBAL\Platforms\SQLServerPlatform;
use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\Exception\UnknownColumnOption;
use Doctrine\DBAL\Types\Type;
Expand Down Expand Up @@ -116,7 +116,7 @@ public function testQuotedColumnName(): void

$column = new Column('[bar]', $string);

$sqlServerPlatform = new SQLServer2012Platform();
$sqlServerPlatform = new SQLServerPlatform();

self::assertEquals('bar', $column->getName());
self::assertEquals('[bar]', $column->getQuotedName($sqlServerPlatform));
Expand Down

0 comments on commit 6ad8a77

Please sign in to comment.