Skip to content

Commit

Permalink
Remove Postgres 9.3 and MariaDB 10.0 support
Browse files Browse the repository at this point in the history
  • Loading branch information
SenseException authored and morozov committed Mar 18, 2020
1 parent b10befc commit 20229b1
Show file tree
Hide file tree
Showing 19 changed files with 51 additions and 150 deletions.
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ before_commands:
tools:
external_code_coverage:
timeout: 3600
runs: 27 # 22x Travis (jobs with COVERAGE=yes) + 3x AppVeyor (jobs with coverage=yes) + 2x ContinuousPHP
runs: 26 # 21x Travis (jobs with COVERAGE=yes) + 3x AppVeyor (jobs with coverage=yes) + 2x ContinuousPHP

filter:
excluded_paths:
Expand Down
8 changes: 0 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,6 @@ jobs:
- stage: Test
php: 7.3
env: DB=mariadb.mysqli.docker IMAGE=mariadb:10.3 COVERAGE=yes
- stage: Test
dist: trusty
php: 7.3
env: DB=pgsql POSTGRESQL_VERSION=9.3 COVERAGE=yes
services:
- postgresql
addons:
postgresql: "9.3"
- stage: Test
php: 7.3
env: DB=pgsql POSTGRESQL_VERSION=9.4 COVERAGE=yes
Expand Down
16 changes: 16 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Upgrade to 3.0

## 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.
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`

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

DBAL now requires MariaDB 10.1 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 MariaDB version (10.1+ is recommended).

## BC BREAK: PingableConnection and ServerInfoAwareConnection interfaces now extend Connection

All implementations of the `PingableConnection` and `ServerInfoAwareConnection` interfaces have to implement the methods defined in the `Connection` interface as well.
Expand Down
10 changes: 5 additions & 5 deletions docs/en/reference/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -227,20 +227,20 @@ pdo_pgsql
- ``sslmode`` (string): Determines whether or with what priority
a SSL TCP/IP connection will be negotiated with the server.
See the list of available modes:
`https://www.postgresql.org/docs/9.3/static/libpq-connect.html#LIBPQ-CONNECT-SSLMODE`
`https://www.postgresql.org/docs/9.4/static/libpq-connect.html#LIBPQ-CONNECT-SSLMODE`
- ``sslrootcert`` (string): specifies the name of a file containing
SSL certificate authority (CA) certificate(s). If the file exists,
the server's certificate will be verified to be signed by one of these
authorities.
See https://www.postgresql.org/docs/9.3/static/libpq-connect.html#LIBPQ-CONNECT-SSLROOTCERT
See https://www.postgresql.org/docs/9.4/static/libpq-connect.html#LIBPQ-CONNECT-SSLROOTCERT
- ``sslcert`` (string): specifies the file name of the client SSL certificate.
See `https://www.postgresql.org/docs/9.3/static/libpq-connect.html#LIBPQ-CONNECT-SSLCERT`
See `https://www.postgresql.org/docs/9.4/static/libpq-connect.html#LIBPQ-CONNECT-SSLCERT`
- ``sslkey`` (string): specifies the location for the secret key used for the
client certificate.
See `https://www.postgresql.org/docs/9.3/static/libpq-connect.html#LIBPQ-CONNECT-SSLKEY`
See `https://www.postgresql.org/docs/9.4/static/libpq-connect.html#LIBPQ-CONNECT-SSLKEY`
- ``sslcrl`` (string): specifies the file name of the SSL certificate
revocation list (CRL).
See `https://www.postgresql.org/docs/9.3/static/libpq-connect.html#LIBPQ-CONNECT-SSLCRL`
See `https://www.postgresql.org/docs/9.4/static/libpq-connect.html#LIBPQ-CONNECT-SSLCRL`
- ``application_name`` (string): Name of the application that is
connecting to database. Optional. It will be displayed at ``pg_stat_activity``.

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 @@ -56,8 +56,7 @@ Microsoft SQL Server
PostgreSQL
^^^^^^^^^^

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

SAP Sybase SQL Anywhere
Expand Down
4 changes: 1 addition & 3 deletions docs/en/reference/types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -741,9 +741,7 @@ Please also notice the mapping specific footnotes for additional information.
| | | | +----------------------------------------------------------+
| | | | | ``LONGTEXT`` [19]_ |
| | +--------------------------+---------+----------------------------------------------------------+
| | | **PostgreSQL** | < 9.4 | ``JSON`` |
| | | +---------+----------------------------------------------------------+
| | | | >= 9.4 | ``JSON`` [20]_ |
| | | **PostgreSQL** | *all* | ``JSON`` [20]_ |
| | | | +----------------------------------------------------------+
| | | | | ``JSONB`` [21]_ |
| | +--------------------------+---------+----------------------------------------------------------+
Expand Down
14 changes: 5 additions & 9 deletions lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\PostgreSQL100Platform;
use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
use Doctrine\DBAL\Schema\PostgreSqlSchemaManager;
use Doctrine\DBAL\VersionAwarePlatformDriver;
Expand All @@ -22,7 +21,7 @@ abstract class AbstractPostgreSQLDriver implements ExceptionConverterDriver, Ver
/**
* {@inheritdoc}
*
* @link http://www.postgresql.org/docs/9.3/static/errcodes-appendix.html
* @link http://www.postgresql.org/docs/9.4/static/errcodes-appendix.html
*/
public function convertException($message, DriverException $exception)
{
Expand Down Expand Up @@ -93,14 +92,11 @@ public function createDatabasePlatformForVersion($version)
$patchVersion = $versionParts['patch'] ?? 0;
$version = $majorVersion . '.' . $minorVersion . '.' . $patchVersion;

switch (true) {
case version_compare($version, '10.0', '>='):
return new PostgreSQL100Platform();
case version_compare($version, '9.4', '>='):
return new PostgreSQL94Platform();
default:
return new PostgreSqlPlatform();
if (version_compare($version, '10.0', '>=')) {
return new PostgreSQL100Platform();
}

return new PostgreSqlPlatform();
}

/**
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 PostgreSQL94Keywords
class PostgreSQL100Keywords extends PostgreSQLKeywords
{
/**
* {@inheritdoc}
Expand Down
32 changes: 0 additions & 32 deletions lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQL94Keywords.php

This file was deleted.

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

/**
* PostgreSQL 9.3 keywords list.
* PostgreSQL keywords list.
*/
class PostgreSQLKeywords extends KeywordList
{
Expand Down Expand Up @@ -77,6 +77,7 @@ protected function getKeywords()
'IS',
'ISNULL',
'JOIN',
'LATERAL',
'LEADING',
'LEFT',
'LIKE',
Expand All @@ -93,7 +94,6 @@ protected function getKeywords()
'OR',
'ORDER',
'OUTER',
'OVER',
'OVERLAPS',
'PLACING',
'PRIMARY',
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 PostgreSQL94Platform
class PostgreSQL100Platform extends PostgreSqlPlatform
{
/**
* {@inheritdoc}
Expand Down
41 changes: 0 additions & 41 deletions lib/Doctrine/DBAL/Platforms/PostgreSQL94Platform.php

This file was deleted.

5 changes: 5 additions & 0 deletions lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -1150,6 +1150,7 @@ protected function initializeDoctrineTypeMappings()
'integer' => 'integer',
'interval' => 'string',
'json' => Type::JSON,
'jsonb' => Type::JSON,
'money' => 'decimal',
'numeric' => 'decimal',
'serial' => 'integer',
Expand Down Expand Up @@ -1251,6 +1252,10 @@ public function getColumnCollationDeclarationSQL($collation)
*/
public function getJsonTypeDeclarationSQL(array $field)
{
if (! empty($field['jsonb'])) {
return 'JSONB';
}

return 'JSON';
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Platforms\Keywords\DB2Keywords;
use Doctrine\DBAL\Platforms\Keywords\MariaDb102Keywords;
use Doctrine\DBAL\Platforms\Keywords\MySQL57Keywords;
use Doctrine\DBAL\Platforms\Keywords\MySQL80Keywords;
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\SQLAnywhereKeywords;
Expand All @@ -33,9 +33,9 @@ class ReservedWordsCommand extends Command
'mysql' => MySQLKeywords::class,
'mysql57' => MySQL57Keywords::class,
'mysql80' => MySQL80Keywords::class,
'mariadb102' => MariaDb102Keywords::class,
'oracle' => OracleKeywords::class,
'pgsql' => PostgreSQLKeywords::class,
'pgsql94' => PostgreSQL94Keywords::class,
'pgsql100' => PostgreSQL100Keywords::class,
'sqlanywhere' => SQLAnywhereKeywords::class,
'sqlite' => SQLiteKeywords::class,
Expand Down Expand Up @@ -90,8 +90,8 @@ protected function configure()
* mysql
* mysql57
* mysql80
* mariadb102
* pgsql
* pgsql94
* pgsql100
* sqlite
* oracle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Doctrine\DBAL\Driver\ResultStatement;
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 Down Expand Up @@ -65,12 +64,9 @@ protected function createSchemaManager(Connection $connection) : AbstractSchemaM
protected function getDatabasePlatformsForVersions() : array
{
return [
['9.3', PostgreSqlPlatform::class],
['9.3.0', PostgreSqlPlatform::class],
['9.3.6', PostgreSqlPlatform::class],
['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
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Doctrine\Tests\DBAL\Functional\Schema;

use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
use Doctrine\DBAL\Schema;
use Doctrine\DBAL\Schema\Comparator;
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
Expand Down Expand Up @@ -401,7 +401,7 @@ public function testPartialIndexes() : void
*/
public function testJsonbColumn(string $type) : void
{
if (! $this->schemaManager->getDatabasePlatform() instanceof PostgreSQL94Platform) {
if (! $this->schemaManager->getDatabasePlatform() instanceof PostgreSqlPlatform) {
$this->markTestSkipped('Requires PostgresSQL 9.4+');

return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\PostgreSQL100Platform;

class PostgreSQL100PlatformTest extends PostgreSQL94PlatformTest
class PostgreSQL100PlatformTest extends PostgreSqlPlatformTest
{
/**
* {@inheritdoc}
Expand Down
32 changes: 0 additions & 32 deletions tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL94PlatformTest.php

This file was deleted.

Loading

0 comments on commit 20229b1

Please sign in to comment.