Skip to content

Commit

Permalink
Made some platform class names reflect the lowest server version they…
Browse files Browse the repository at this point in the history
… support

The `PostgreSqlPlatform`, `SQLAnywherePlatform` and `SQLServerPlatform` classes have been renamed to `PostgreSQL94Platform`, `SQLAnywhere16Platform` and `SQLServer2012Platform` respectively.

When deprecating an old platform version, we can deprecate and later remove a specific class. Otherwise, there's no way to express the deprecation on the class level and the upgrade notes contain sentences like: "`XYZPlatform` and `XYZKeywords` now represent XYZ (version)".
  • Loading branch information
morozov committed Mar 20, 2020
1 parent cf67e01 commit 9d6d4cc
Show file tree
Hide file tree
Showing 31 changed files with 102 additions and 120 deletions.
58 changes: 23 additions & 35 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
# Upgrade to 3.0

## BC BREAK: Removed support for SQL Anywhere 12 and older

DBAL now requires SQL Anywhere 16 or newer, support for unmaintained versions has been dropped.
If you are using any of the legacy versions, you have to upgrade to newer SQL Anywhere version (16+).

The following classes have been removed:

* `Doctrine\DBAL\Platforms\SQLAnywherePlatform`
* `Doctrine\DBAL\Platforms\SQLAnywhere11Platform`
* `Doctrine\DBAL\Platforms\SQLAnywhere12Platform`
* `Doctrine\DBAL\Platforms\Keywords\SQLAnywhereKeywords`
* `Doctrine\DBAL\Platforms\Keywords\SQLAnywhere11Keywords`
* `Doctrine\DBAL\Platforms\Keywords\SQLAnywhere12Keywords`

## BC BREAK: Removed support for PostgreSQL 9.3 and older

DBAL now requires PostgeSQL 9.4 or newer, support for unmaintained versions has been dropped.
DBAL now requires PostgreSQL 9.4 or newer, support for unmaintained versions has been dropped.
If you are using any of the legacy versions, you have to upgrade to a newer PostgreSQL version (9.6+ is recommended).
`Doctrine\DBAL\Platforms\PostgreSqlPlatform` and `Doctrine\DBAL\Platforms\Keywords\PostgreSQLKeywords` now represent PostgreSQL 9.4.

The following classes have been removed:

* `Doctrine\DBAL\Platforms\PostgreSQL94Platform`
* `Doctrine\DBAL\Platforms\Keywords\PostgreSQL94Keywords`
* `Doctrine\DBAL\Platforms\PostgreSqlPlatform`
* `Doctrine\DBAL\Platforms\PostgreSQL91Platform`
* `Doctrine\DBAL\Platforms\PostgreSQL92Platform`
* `Doctrine\DBAL\Platforms\Keywords\PostgreSQLKeywords`
* `Doctrine\DBAL\Platforms\Keywords\PostgreSQL91Keywords`
* `Doctrine\DBAL\Platforms\Keywords\PostgreSQL92Keywords`

## BC BREAK: Removed support for MariaDB 10.0 and older

Expand Down Expand Up @@ -37,51 +54,22 @@ The following class has been removed:

* `Doctrine\DBAL\Driver\PDOIbm\Driver`

## BC BREAK: Removed support for SQL Anywhere 12 and older

DBAL now requires SQL Anywhere 16 or newer, support for unmaintained versions has been dropped.
If you are using any of the legacy versions, you have to upgrade to a newer SQL Anywhere version (16+).
`Doctrine\DBAL\Platforms\SQLAnywherePlatform` and `Doctrine\DBAL\Platforms\Keywords\SQLAnywhereKeywords` now represent SQL Anywhere 16.

The following classes have been removed:

* `Doctrine\DBAL\Platforms\SQLAnywhere11Platform`
* `Doctrine\DBAL\Platforms\SQLAnywhere12Platform`
* `Doctrine\DBAL\Platforms\SQLAnywhere16Platform`
* `Doctrine\DBAL\Platforms\Keywords\SQLAnywhere11Keywords`
* `Doctrine\DBAL\Platforms\Keywords\SQLAnywhere12Keywords`
* `Doctrine\DBAL\Platforms\Keywords\SQLAnywhere16Keywords`

## BC BREAK: Removed support for SQL Server 2008 and older

DBAL now requires SQL Server 2012 or newer, support for unmaintained versions has been dropped.
If you are using any of the legacy versions, you have to upgrade to a newer SQL Server version.
`Doctrine\DBAL\Platforms\SQLServerPlatform` and `Doctrine\DBAL\Platforms\Keywords\SQLServerKeywords` now represent SQL Server 2012.

The following classes have been removed:

* `Doctrine\DBAL\Platforms\SQLServerPlatform`
* `Doctrine\DBAL\Platforms\SQLServer2005Platform`
* `Doctrine\DBAL\Platforms\SQLServer2008Platform`
* `Doctrine\DBAL\Platforms\SQLServer2012Platform`
* `Doctrine\DBAL\Platforms\Keywords\SQLServerKeywords`
* `Doctrine\DBAL\Platforms\Keywords\SQLServer2005Keywords`
* `Doctrine\DBAL\Platforms\Keywords\SQLServer2008Keywords`
* `Doctrine\DBAL\Platforms\Keywords\SQLServer2012Keywords`

The `AbstractSQLServerDriver` class and its subclasses no longer implement the `VersionAwarePlatformDriver` interface.

## BC BREAK: Removed support for PostgreSQL 9.2 and older

DBAL now requires PostgeSQL 9.3 or newer, support for unmaintained versions has been dropped.
If you are using any of the legacy versions, you have to upgrade to a newer PostgreSQL version (9.6+ is recommended).
`Doctrine\DBAL\Platforms\PostgreSqlPlatform` and `Doctrine\DBAL\Platforms\Keywords\PostgreSQLKeywords` now represent PostgreSQL 9.3.

The following classes have been removed:

* `Doctrine\DBAL\Platforms\PostgreSQL91Platform`
* `Doctrine\DBAL\Platforms\PostgreSQL92Platform`
* `Doctrine\DBAL\Platforms\Keywords\PostgreSQL91Keywords`
* `Doctrine\DBAL\Platforms\Keywords\PostgreSQL92Keywords`

## BC BREAK: Removed Doctrine\DBAL\Version

The `Doctrine\DBAL\Version` class is no longer available: please refrain from checking the DBAL version at runtime.
Expand Down
6 changes: 3 additions & 3 deletions docs/en/reference/platforms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,18 @@ Oracle
Microsoft SQL Server
^^^^^^^^^^^^^^^^^^^^

- ``SQLServerPlatform`` for version 2012 and above.
- ``SQLServer2012Platform`` for version 2012 and above.

PostgreSQL
^^^^^^^^^^

- ``PostgreSqlPlatform`` for version 9.4 and above.
- ``PostgreSQL94Platform`` for version 9.4 and above.
- ``PostgreSQL100Platform`` for version 10.0 and above.

SAP Sybase SQL Anywhere
^^^^^^^^^^^^^^^^^^^^^^^

- ``SQLAnywherePlatform`` for version 16 and above.
- ``SQLAnywhere16Platform`` for version 16 and above.

SQLite
^^^^^^
Expand Down
6 changes: 3 additions & 3 deletions lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\PostgreSQL100Platform;
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
use Doctrine\DBAL\Schema\PostgreSqlSchemaManager;
use Doctrine\DBAL\VersionAwarePlatformDriver;
use function preg_match;
Expand Down Expand Up @@ -96,7 +96,7 @@ public function createDatabasePlatformForVersion($version)
return new PostgreSQL100Platform();
}

return new PostgreSqlPlatform();
return new PostgreSQL94Platform();
}

/**
Expand All @@ -114,7 +114,7 @@ public function getDatabase(Connection $conn)
*/
public function getDatabasePlatform()
{
return new PostgreSqlPlatform();
return new PostgreSQL94Platform();
}

/**
Expand Down
6 changes: 3 additions & 3 deletions lib/Doctrine/DBAL/Driver/AbstractSQLAnywhereDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\SQLAnywherePlatform;
use Doctrine\DBAL\Platforms\SQLAnywhere16Platform;
use Doctrine\DBAL\Schema\SQLAnywhereSchemaManager;
use Doctrine\DBAL\VersionAwarePlatformDriver;
use function preg_match;
Expand Down Expand Up @@ -84,7 +84,7 @@ public function createDatabasePlatformForVersion($version)

switch (true) {
default:
return new SQLAnywherePlatform();
return new SQLAnywhere16Platform();
}
}

Expand All @@ -103,7 +103,7 @@ public function getDatabase(Connection $conn)
*/
public function getDatabasePlatform()
{
return new SQLAnywherePlatform();
return new SQLAnywhere16Platform();
}

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/DBAL/Driver/AbstractSQLServerDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Platforms\SQLServerPlatform;
use Doctrine\DBAL\Platforms\SQLServer2012Platform;
use Doctrine\DBAL\Schema\SQLServerSchemaManager;

/**
Expand All @@ -27,7 +27,7 @@ public function getDatabase(Connection $conn)
*/
public function getDatabasePlatform()
{
return new SQLServerPlatform();
return new SQLServer2012Platform();
}

/**
Expand Down
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 PostgreSQLKeywords
class PostgreSQL100Keywords extends PostgreSQL94Keywords
{
/**
* {@inheritdoc}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace Doctrine\DBAL\Platforms\Keywords;

/**
* PostgreSQL keywords list.
* PostgreSQL 9.4 reserved keywords list.
*/
class PostgreSQLKeywords extends KeywordList
class PostgreSQL94Keywords extends KeywordList
{
/**
* {@inheritdoc}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Doctrine\DBAL\Platforms\Keywords;

/**
* SAP Sybase SQL Anywhere 10 reserved keywords list.
* SAP Sybase SQL Anywhere 16 reserved keywords list.
*/
class SQLAnywhereKeywords extends KeywordList
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
namespace Doctrine\DBAL\Platforms\Keywords;

/**
* Microsoft SQL Server 2000 reserved keyword dictionary.
*
* @link www.doctrine-project.com
* Microsoft SQL Server 2012 reserved keyword dictionary.
*/
class SQLServerKeywords extends KeywordList
class SQLServer2012Keywords extends KeywordList
{
/**
* {@inheritdoc}
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Platforms/PostgreSQL100Platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/**
* Provides the behavior, features and SQL dialect of the PostgreSQL 10.0 database platform.
*/
class PostgreSQL100Platform extends PostgreSqlPlatform
class PostgreSQL100Platform extends PostgreSQL94Platform
{
/**
* {@inheritdoc}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,8 @@

/**
* Provides the behavior, features and SQL dialect of the PostgreSQL 9.4+ database platform.
*
* @todo Rename: PostgreSQLPlatform
*/
class PostgreSqlPlatform extends AbstractPlatform
class PostgreSQL94Platform extends AbstractPlatform
{
/** @var bool */
private $useBooleanTrueFalseStrings = true;
Expand Down Expand Up @@ -1208,7 +1206,7 @@ public function hasNativeJsonType()
*/
protected function getReservedKeywordsClass()
{
return Keywords\PostgreSQLKeywords::class;
return Keywords\PostgreSQL94Keywords::class;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@
use function substr;

/**
* The SQLAnywherePlatform provides the behavior, features and SQL dialect of the
* SAP Sybase SQL Anywhere 16 database platform.
* Provides the behavior, features and SQL dialect of the SAP Sybase SQL Anywhere 16 database platform.
*/
class SQLAnywherePlatform extends AbstractPlatform
class SQLAnywhere16Platform extends AbstractPlatform
{
public const FOREIGN_KEY_MATCH_SIMPLE = 1;
public const FOREIGN_KEY_MATCH_FULL = 2;
Expand Down Expand Up @@ -549,7 +548,7 @@ public function getDropIndexSQL($index, $table = null)

if (! is_string($index)) {
throw new InvalidArgumentException(
'SQLAnywherePlatform::getDropIndexSQL() expects $index parameter to be string or ' . Index::class . '.'
'AbstractPlatform::getDropIndexSQL() expects $index parameter to be string or ' . Index::class . '.'
);
}

Expand All @@ -563,7 +562,7 @@ public function getDropIndexSQL($index, $table = null)

if (! is_string($table)) {
throw new InvalidArgumentException(
'SQLAnywherePlatform::getDropIndexSQL() expects $table parameter to be string or ' . Index::class . '.'
'AbstractPlatform::getDropIndexSQL() expects $table parameter to be string or ' . Index::class . '.'
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@
use function substr_count;

/**
* The SQLServerPlatform provides the behavior, features and SQL dialect of the
* Microsoft SQL Server database platform.
* Provides the behavior, features and SQL dialect of the Microsoft SQL Server 2012 database platform.
*/
class SQLServerPlatform extends AbstractPlatform
class SQLServer2012Platform extends AbstractPlatform
{
/**
* {@inheritdoc}
Expand Down Expand Up @@ -1568,7 +1567,7 @@ public function getForUpdateSQL()
*/
protected function getReservedKeywordsClass()
{
return Keywords\SQLServerKeywords::class;
return Keywords\SQLServer2012Keywords::class;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Doctrine\DBAL\Exception\DriverException;
use Doctrine\DBAL\FetchMode;
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Types\Types;
use const CASE_LOWER;
Expand Down Expand Up @@ -114,7 +114,7 @@ public function dropDatabase($database)
throw $exception;
}

assert($this->_platform instanceof PostgreSqlPlatform);
assert($this->_platform instanceof PostgreSQL94Platform);

$this->_execSql(
[
Expand Down Expand Up @@ -494,7 +494,7 @@ public function listTableDetails($tableName) : Table
{
$table = parent::listTableDetails($tableName);

/** @var PostgreSqlPlatform $platform */
/** @var PostgreSQL94Platform $platform */
$platform = $this->_platform;
$sql = $platform->getListTableMetadataSQL($tableName);

Expand Down
6 changes: 3 additions & 3 deletions lib/Doctrine/DBAL/Schema/SQLAnywhereSchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Doctrine\DBAL\Schema;

use Doctrine\DBAL\Platforms\SQLAnywherePlatform;
use Doctrine\DBAL\Platforms\SQLAnywhere16Platform;
use Doctrine\DBAL\Types\Type;
use function assert;
use function is_string;
Expand Down Expand Up @@ -50,7 +50,7 @@ public function dropDatabase($database)
*/
public function startDatabase($database)
{
assert($this->_platform instanceof SQLAnywherePlatform);
assert($this->_platform instanceof SQLAnywhere16Platform);
$this->_execSql($this->_platform->getStartDatabaseSQL($database));
}

Expand All @@ -61,7 +61,7 @@ public function startDatabase($database)
*/
public function stopDatabase($database)
{
assert($this->_platform instanceof SQLAnywherePlatform);
assert($this->_platform instanceof SQLAnywhere16Platform);
$this->_execSql($this->_platform->getStopDatabaseSQL($database));
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver\DriverException;
use Doctrine\DBAL\Platforms\SQLServerPlatform;
use Doctrine\DBAL\Platforms\SQLServer2012Platform;
use Doctrine\DBAL\Types\Type;
use PDOException;
use Throwable;
Expand Down Expand Up @@ -334,7 +334,7 @@ public function listTableDetails($tableName) : Table
{
$table = parent::listTableDetails($tableName);

/** @var SQLServerPlatform $platform */
/** @var SQLServer2012Platform $platform */
$platform = $this->_platform;
$sql = $platform->getListTableMetadataSQL($tableName);

Expand Down
Loading

0 comments on commit 9d6d4cc

Please sign in to comment.