Skip to content

Commit

Permalink
Deprecate support for Postgres 10 and 11 (#6495)
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabus committed Aug 14, 2024
1 parent 7cade22 commit 377d051
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 5 deletions.
3 changes: 2 additions & 1 deletion UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ awareness about deprecated code.
The `TableDiff` methods `getModifiedColumns()` and `getRenamedColumns()` have been merged into a single
method `getChangedColumns()`. Use this method instead.

## Deprecated support for MariaDB 10.4 and MySQL 5.7
## Deprecated support for MariaDB 10.4, MySQL 5.7 and Postgres 10 + 11

* Upgrade to MariaDB 10.5 or later.
* Upgrade to MySQL 8.0 or later.
* Upgrade to Postgres 12 or later.

## Add `Result::getColumnName()`

Expand Down
3 changes: 1 addition & 2 deletions docs/en/reference/platforms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ Microsoft SQL Server
PostgreSQL
^^^^^^^^^^

- ``PostgreSQLPlatform`` for version 9.4 and above.
- ``PostgreSQL100Platform`` for version 10.0 and above.
- ``PostgreSQLPlatform`` for version 10.0 and above.
- ``PostgreSQL120Platform`` for version 12.0 and above.

IBM DB2
Expand Down
1 change: 1 addition & 0 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<referencedClass name="Doctrine\DBAL\Platforms\Keywords\MySQL80Keywords" />
<referencedClass name="Doctrine\DBAL\Platforms\MariaDB1052Platform" />
<referencedClass name="Doctrine\DBAL\Platforms\MySQL80Platform" />
<referencedClass name="Doctrine\DBAL\Platforms\PostgreSQL120Platform" />
</errorLevel>
</DeprecatedClass>
<DeprecatedMethod>
Expand Down
7 changes: 7 additions & 0 deletions src/Driver/AbstractPostgreSQLDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Doctrine\DBAL\Platforms\PostgreSQL120Platform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\ServerVersionProvider;
use Doctrine\Deprecations\Deprecation;

use function preg_match;
use function version_compare;
Expand Down Expand Up @@ -40,6 +41,12 @@ public function getDatabasePlatform(ServerVersionProvider $versionProvider): Pos
return new PostgreSQL120Platform();
}

Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/6495',
'Support for Postgres < 12 is deprecated and will be removed in DBAL 5',
);

return new PostgreSQLPlatform();
}

Expand Down
2 changes: 2 additions & 0 deletions src/Platforms/PostgreSQL120Platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

/**
* Provides the behavior, features and SQL dialect of the PostgreSQL 12.0 database platform.
*
* @deprecated This class will be removed once support for Postgres < 12 is dropped.
*/
class PostgreSQL120Platform extends PostgreSQLPlatform
{
Expand Down
3 changes: 2 additions & 1 deletion src/Platforms/PostgreSQLPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
use function trim;

/**
* Provides the behavior, features and SQL dialect of the PostgreSQL 9.4+ database platform.
* Provides the behavior, features and SQL dialect of the PostgreSQL database platform
* of the oldest supported version.
*/
class PostgreSQLPlatform extends AbstractPlatform
{
Expand Down
3 changes: 2 additions & 1 deletion tests/Driver/VersionAwarePlatformDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ public static function postgreSQLVersionProvider(): array
['10.0', PostgreSQLPlatform::class],
['11.0', PostgreSQLPlatform::class],
['12.0', PostgreSQL120Platform::class],
['13.3', PostgreSQL120Platform::class],
['13.16', PostgreSQL120Platform::class],
['16.4', PostgreSQL120Platform::class],
];
}

Expand Down

0 comments on commit 377d051

Please sign in to comment.