Unverified Commit fe9200a4 authored by Michael Moravec's avatar Michael Moravec Committed by Sergei Morozov

Drop support for PostgreSQL <9.3

parent ce32c090
......@@ -21,7 +21,7 @@ before_commands:
tools:
external_code_coverage:
timeout: 3600
runs: 27 # 23x Travis (jobs with COVERAGE=yes) + 3x AppVeyor (jobs with coverage=yes) + 1x ContinuousPHP
runs: 26 # 22x Travis (jobs with COVERAGE=yes) + 3x AppVeyor (jobs with coverage=yes) + 1x ContinuousPHP
filter:
excluded_paths:
......
......@@ -200,14 +200,6 @@ jobs:
addons:
mariadb: 10.3
- stage: Test
php: 7.2
env: DB=pgsql POSTGRESQL_VERSION=9.2 COVERAGE=yes
services:
- postgresql
addons:
postgresql: "9.2"
- stage: Test
php: 7.2
env: DB=pgsql POSTGRESQL_VERSION=9.3 COVERAGE=yes
......
# Upgrade to 3.0
## 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 newer PostgreSQL version (9.6+ is recommended).
`Doctrine\DBAL\Platforms\PostgreSqlPlatform` and `Doctrine\DBAL\Platforms\Keywords\PostgreSQLKeywords` now represent the 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.
......
......@@ -229,20 +229,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:
`http://www.postgresql.org/docs/9.1/static/libpq-connect.html#LIBPQ-CONNECT-SSLMODE`
`https://www.postgresql.org/docs/9.3/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 http://www.postgresql.org/docs/9.0/static/libpq-connect.html#LIBPQ-CONNECT-SSLROOTCERT
See https://www.postgresql.org/docs/9.3/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.1/static/libpq-connect.html#LIBPQ-CONNECT-SSLCERT`
See `https://www.postgresql.org/docs/9.3/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.1/static/libpq-connect.html#LIBPQ-CONNECT-SSLKEY`
See `https://www.postgresql.org/docs/9.3/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.1/static/libpq-connect.html#LIBPQ-CONNECT-SSLCRL`
See `https://www.postgresql.org/docs/9.3/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``.
......
......@@ -59,9 +59,8 @@ PostgreSQL
^^^^^^^^^^
- ``PostgreSqlPlatform`` for all versions.
- ``PostgreSQL91Platform`` for version 9.1 and above.
- ``PostgreSQL92Platform`` for version 9.2 and above.
- ``PostgreSQL94Platform`` for version 9.4 and above.
- ``PostgreSQL100Platform`` for version 10.0 and above.
SAP Sybase SQL Anywhere
^^^^^^^^^^^^^^^^^^^^^^^
......
......@@ -749,9 +749,7 @@ Please also notice the mapping specific footnotes for additional information.
| | | | +----------------------------------------------------------+
| | | | | ``LONGTEXT`` [19]_ |
| | +--------------------------+---------+----------------------------------------------------------+
| | | **PostgreSQL** | < 9.2 | ``TEXT`` [1]_ |
| | | +---------+----------------------------------------------------------+
| | | | < 9.4 | ``JSON`` |
| | | **PostgreSQL** | < 9.4 | ``JSON`` |
| | | +---------+----------------------------------------------------------+
| | | | >= 9.4 | ``JSON`` [20]_ |
| | | | +----------------------------------------------------------+
......
......@@ -7,8 +7,6 @@ use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\PostgreSQL100Platform;
use Doctrine\DBAL\Platforms\PostgreSQL91Platform;
use Doctrine\DBAL\Platforms\PostgreSQL92Platform;
use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
use Doctrine\DBAL\Schema\PostgreSqlSchemaManager;
......@@ -101,10 +99,6 @@ abstract class AbstractPostgreSQLDriver implements Driver, ExceptionConverterDri
return new PostgreSQL100Platform();
case version_compare($version, '9.4', '>='):
return new PostgreSQL94Platform();
case version_compare($version, '9.2', '>='):
return new PostgreSQL92Platform();
case version_compare($version, '9.1', '>='):
return new PostgreSQL91Platform();
default:
return new PostgreSqlPlatform();
}
......
<?php
namespace Doctrine\DBAL\Platforms\Keywords;
/**
* PostgreSQL 9.1 reserved keywords list.
*/
class PostgreSQL91Keywords extends PostgreSQLKeywords
{
/**
* {@inheritdoc}
*/
public function getName()
{
return 'PostgreSQL91';
}
/**
* {@inheritdoc}
*
* @link http://www.postgresql.org/docs/9.1/static/sql-keywords-appendix.html
*/
protected function getKeywords()
{
return [
'ALL',
'ANALYSE',
'ANALYZE',
'AND',
'ANY',
'ARRAY',
'AS',
'ASC',
'ASYMMETRIC',
'AUTHORIZATION',
'BINARY',
'BOTH',
'CASE',
'CAST',
'CHECK',
'COLLATE',
'COLUMN',
'CONCURRENTLY',
'CONSTRAINT',
'CREATE',
'CROSS',
'CURRENT_CATALOG',
'CURRENT_DATE',
'CURRENT_ROLE',
'CURRENT_SCHEMA',
'CURRENT_TIME',
'CURRENT_TIMESTAMP',
'CURRENT_USER',
'DEFAULT',
'DEFERRABLE',
'DESC',
'DISTINCT',
'DO',
'ELSE',
'END',
'EXCEPT',
'FALSE',
'FETCH',
'FOR',
'FOREIGN',
'FREEZE',
'FROM',
'FULL',
'GRANT',
'GROUP',
'HAVING',
'ILIKE',
'IN',
'INITIALLY',
'INNER',
'INTERSECT',
'INTO',
'IS',
'ISNULL',
'JOIN',
'LEADING',
'LEFT',
'LIKE',
'LIMIT',
'LOCALTIME',
'LOCALTIMESTAMP',
'NATURAL',
'NOT',
'NOTNULL',
'NULL',
'OFFSET',
'ON',
'ONLY',
'OR',
'ORDER',
'OUTER',
'OVER',
'OVERLAPS',
'PLACING',
'PRIMARY',
'REFERENCES',
'RETURNING',
'RIGHT',
'SELECT',
'SESSION_USER',
'SIMILAR',
'SOME',
'SYMMETRIC',
'TABLE',
'THEN',
'TO',
'TRAILING',
'TRUE',
'UNION',
'UNIQUE',
'USER',
'USING',
'VARIADIC',
'VERBOSE',
'WHEN',
'WHERE',
'WINDOW',
'WITH',
];
}
}
<?php
namespace Doctrine\DBAL\Platforms\Keywords;
use function array_merge;
/**
* PostgreSQL 9.2 reserved keywords list.
*/
class PostgreSQL92Keywords extends PostgreSQL91Keywords
{
/**
* {@inheritdoc}
*/
public function getName()
{
return 'PostgreSQL92';
}
/**
* {@inheritdoc}
*
* @link http://www.postgresql.org/docs/9.2/static/sql-keywords-appendix.html
*/
protected function getKeywords()
{
return array_merge(parent::getKeywords(), ['COLLATION']);
}
}
......@@ -8,7 +8,7 @@ use function array_merge;
/**
* PostgreSQL 9.4 reserved keywords list.
*/
class PostgreSQL94Keywords extends PostgreSQL92Keywords
class PostgreSQL94Keywords extends PostgreSQLKeywords
{
/**
* {@inheritdoc}
......
......@@ -3,7 +3,7 @@
namespace Doctrine\DBAL\Platforms\Keywords;
/**
* PostgreSQL Keywordlist.
* PostgreSQL 9.3 keywords list.
*/
class PostgreSQLKeywords extends KeywordList
{
......@@ -26,20 +26,27 @@ class PostgreSQLKeywords extends KeywordList
'ANALYZE',
'AND',
'ANY',
'ARRAY',
'AS',
'ASC',
'ASYMMETRIC',
'AUTHORIZATION',
'BETWEEN',
'BINARY',
'BOTH',
'CASE',
'CAST',
'CHECK',
'COLLATE',
'COLLATION',
'COLUMN',
'CONCURRENTLY',
'CONSTRAINT',
'CREATE',
'CROSS',
'CURRENT_CATALOG',
'CURRENT_DATE',
'CURRENT_ROLE',
'CURRENT_SCHEMA',
'CURRENT_TIME',
'CURRENT_TIMESTAMP',
'CURRENT_USER',
......@@ -52,6 +59,7 @@ class PostgreSQLKeywords extends KeywordList
'END',
'EXCEPT',
'FALSE',
'FETCH',
'FOR',
'FOREIGN',
'FREEZE',
......@@ -76,26 +84,27 @@ class PostgreSQLKeywords extends KeywordList
'LOCALTIME',
'LOCALTIMESTAMP',
'NATURAL',
'NEW',
'NOT',
'NOTNULL',
'NULL',
'OFF',
'OFFSET',
'OLD',
'ON',
'ONLY',
'OR',
'ORDER',
'OUTER',
'OVER',
'OVERLAPS',
'PLACING',
'PRIMARY',
'REFERENCES',
'RETURNING',
'RIGHT',
'SELECT',
'SESSION_USER',
'SIMILAR',
'SOME',
'SYMMETRIC',
'TABLE',
'THEN',
'TO',
......@@ -105,9 +114,12 @@ class PostgreSQLKeywords extends KeywordList
'UNIQUE',
'USER',
'USING',
'VARIADIC',
'VERBOSE',
'WHEN',
'WHERE',
'WINDOW',
'WITH',
];
}
}
<?php
namespace Doctrine\DBAL\Platforms;
use function explode;
/**
* Provides the behavior, features and SQL dialect of the PostgreSQL 9.1 database platform.
*/
class PostgreSQL91Platform extends PostgreSqlPlatform
{
/**
* {@inheritDoc}
*/
public function supportsColumnCollation()
{
return true;
}
/**
* {@inheritdoc}
*/
protected function getReservedKeywordsClass()
{
return Keywords\PostgreSQL91Keywords::class;
}
/**
* {@inheritDoc}
*/
public function getColumnCollationDeclarationSQL($collation)
{
return 'COLLATE ' . $this->quoteSingleIdentifier($collation);
}
/**
* {@inheritDoc}
*/
public function getListTableColumnsSQL($table, $database = null)
{
$sql = parent::getListTableColumnsSQL($table, $database);
$parts = explode('AS complete_type,', $sql, 2);
return $parts[0] . 'AS complete_type, (SELECT tc.collcollate FROM pg_catalog.pg_collation tc WHERE tc.oid = a.attcollation) AS collation,' . $parts[1];
}
}
<?php
namespace Doctrine\DBAL\Platforms;
use Doctrine\DBAL\Types\Type;
use function sprintf;
/**
* Provides the behavior, features and SQL dialect of the PostgreSQL 9.2 database platform.
*/
class PostgreSQL92Platform extends PostgreSQL91Platform
{
/**
* {@inheritdoc}
*/
public function getJsonTypeDeclarationSQL(array $field)
{
return 'JSON';
}
/**
* {@inheritdoc}
*/
public function getSmallIntTypeDeclarationSQL(array $field)
{
if (! empty($field['autoincrement'])) {
return 'SMALLSERIAL';
}
return parent::getSmallIntTypeDeclarationSQL($field);
}
/**
* {@inheritdoc}
*/
public function hasNativeJsonType()
{
return true;
}
/**
* {@inheritdoc}
*/
protected function getReservedKeywordsClass()
{
return Keywords\PostgreSQL92Keywords::class;
}
/**
* {@inheritdoc}
*/
protected function initializeDoctrineTypeMappings()
{
parent::initializeDoctrineTypeMappings();
$this->doctrineTypeMapping['json'] = Type::JSON;
}
/**
* {@inheritdoc}
*/
public function getCloseActiveDatabaseConnectionsSQL($database)
{
return sprintf(
'SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = %s',
$this->quoteStringLiteral($database)
);
}
}
......@@ -7,7 +7,7 @@ use Doctrine\DBAL\Types\Type;
/**
* Provides the behavior, features and SQL dialect of the PostgreSQL 9.4 database platform.
*/
class PostgreSQL94Platform extends PostgreSQL92Platform
class PostgreSQL94Platform extends PostgreSqlPlatform
{
/**
* {@inheritdoc}
......
......@@ -33,7 +33,7 @@ use function strtolower;
use function trim;
/**
* PostgreSqlPlatform.
* Provides the behavior, features and SQL dialect of the PostgreSQL 9.4+ database platform.
*
* @todo Rename: PostgreSQLPlatform
*/
......@@ -392,6 +392,7 @@ SQL
quote_ident(a.attname) AS field,
t.typname AS type,
format_type(a.atttypid, a.atttypmod) AS complete_type,
(SELECT tc.collcollate FROM pg_catalog.pg_collation tc WHERE tc.oid = a.attcollation) AS collation,
(SELECT t1.typname FROM pg_catalog.pg_type t1 WHERE t1.oid = t.typbasetype) AS domain_type,
(SELECT format_type(t2.typbasetype, t2.typtypmod) FROM
pg_catalog.pg_type t2 WHERE t2.typtype = 'd' AND t2.oid = a.atttypid) AS domain_complete_type,
......@@ -452,7 +453,7 @@ SQL
*/
public function getCloseActiveDatabaseConnectionsSQL($database)
{
return 'SELECT pg_terminate_backend(procpid) FROM pg_stat_activity WHERE datname = '
return 'SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = '
. $this->quoteStringLiteral($database);
}
......@@ -967,6 +968,10 @@ SQL
*/
public function getSmallIntTypeDeclarationSQL(array $field)
{
if (! empty($field['autoincrement'])) {
return 'SMALLSERIAL';
}
return 'SMALLINT';
}
......@@ -1155,6 +1160,7 @@ SQL
'year' => 'date',
'uuid' => 'guid',
'bytea' => 'blob',
'json' => Type::JSON,
];
}
......@@ -1182,6 +1188,14 @@ SQL
return 0;
}
/**
* {@inheritdoc}
*/
public function hasNativeJsonType()
{
return true;
}
/**
* {@inheritDoc}
*/
......@@ -1210,6 +1224,30 @@ SQL
return parent::getDefaultValueDeclarationSQL($field);
}
/**
* {@inheritdoc}
*/
public function supportsColumnCollation()
{
return true;
}
/**
* {@inheritdoc}
*/
public function getColumnCollationDeclarationSQL($collation)
{
return 'COLLATE ' . $this->quoteSingleIdentifier($collation);
}
/**
* {@inheritdoc}
*/
public function getJsonTypeDeclarationSQL(array $field)
{
return 'JSON';
}
/**
* @param mixed[] $field
*/
......
......@@ -8,8 +8,8 @@ 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\PostgreSQL91Keywords;
use Doctrine\DBAL\Platforms\Keywords\PostgreSQL92Keywords;
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\SQLAnywhere11Keywords;
......@@ -44,8 +44,8 @@ class ReservedWordsCommand extends Command
'sqlserver2012' => SQLServer2012Keywords::class,
'sqlite' => SQLiteKeywords::class,
'pgsql' => PostgreSQLKeywords::class,
'pgsql91' => PostgreSQL91Keywords::class,
'pgsql92' => PostgreSQL92Keywords::class,
'pgsql94' => PostgreSQL94Keywords::class,
'pgsql100' => PostgreSQL100Keywords::class,
'oracle' => OracleKeywords::class,
'db2' => DB2Keywords::class,
'sqlanywhere' => SQLAnywhereKeywords::class,
......@@ -102,7 +102,8 @@ The following keyword lists are currently shipped with Doctrine:
* mysql57
* mysql80
* pgsql
* pgsql92
* pgsql94
* pgsql100
* sqlite
* oracle
* sqlserver
......@@ -128,23 +129,7 @@ EOT
$keywordLists = (array) $input->getOption('list');
if (! $keywordLists) {
$keywordLists = [
'mysql',
'mysql57',
'mysql80',
'pgsql',
'pgsql92',
'sqlite',
'oracle',
'sqlserver',
'sqlserver2005',
'sqlserver2008',
'sqlserver2012',
'sqlanywhere',
'sqlanywhere11',
'sqlanywhere12',
'sqlanywhere16',
];
$keywordLists = array_keys($this->keywordListClasses);
}
$keywords = [];
......
......@@ -5,8 +5,6 @@ namespace Doctrine\Tests\DBAL\Driver;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver\AbstractPostgreSQLDriver;
use Doctrine\DBAL\Platforms\PostgreSQL100Platform;
use Doctrine\DBAL\Platforms\PostgreSQL91Platform;
use Doctrine\DBAL\Platforms\PostgreSQL92Platform;
use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
use Doctrine\DBAL\Schema\PostgreSqlSchemaManager;
......@@ -61,15 +59,9 @@ class AbstractPostgreSQLDriverTest extends AbstractDriverTest
protected function getDatabasePlatformsForVersions()
{
return [
['9.0.9', PostgreSqlPlatform::class],
['9.1', PostgreSQL91Platform::class],
['9.1.0', PostgreSQL91Platform::class],
['9.1.1', PostgreSQL91Platform::class],
['9.1.9', PostgreSQL91Platform::class],
['9.2', PostgreSQL92Platform::class],
['9.2.0', PostgreSQL92Platform::class],
['9.2.1', PostgreSQL92Platform::class],
['9.3.6', PostgreSQL92Platform::class],
['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],
......
<?php
namespace Doctrine\Tests\DBAL\Platforms;
use Doctrine\DBAL\Platforms\PostgreSQL91Platform;
use Doctrine\DBAL\Schema\Table;
class PostgreSQL91PlatformTest extends PostgreSqlPlatformTest
{
public function createPlatform()
{
return new PostgreSQL91Platform();
}
public function testSupportsColumnCollation() : void
{
self::assertTrue($this->platform->supportsColumnCollation());
}
public function testColumnCollationDeclarationSQL() : void
{
self::assertSame(
'COLLATE "en_US.UTF-8"',
$this->platform->getColumnCollationDeclarationSQL('en_US.UTF-8')
);
}
public function testGetCreateTableSQLWithColumnCollation() : void
{
$table = new Table('foo');
$table->addColumn('no_collation', 'string');
$table->addColumn('column_collation', 'string')->setPlatformOption('collation', 'en_US.UTF-8');
self::assertSame(
['CREATE TABLE foo (no_collation VARCHAR(255) NOT NULL, column_collation VARCHAR(255) NOT NULL COLLATE "en_US.UTF-8")'],
$this->platform->getCreateTableSQL($table),
'Column "no_collation" will use the default collation from the table/database and "column_collation" overwrites the collation on this column'
);
}
}
<?php
namespace Doctrine\Tests\DBAL\Platforms;
use Doctrine\DBAL\Platforms\PostgreSQL92Platform;
use Doctrine\DBAL\Types\Type;
class PostgreSQL92PlatformTest extends AbstractPostgreSqlPlatformTestCase
{
/**
* {@inheritdoc}
*/
public function createPlatform()
{
return new PostgreSQL92Platform();
}
/**
* @group DBAL-553
*/
public function testHasNativeJsonType()
{
self::assertTrue($this->platform->hasNativeJsonType());
}
/**
* @group DBAL-553
*/
public function testReturnsJsonTypeDeclarationSQL()
{
self::assertSame('JSON', $this->platform->getJsonTypeDeclarationSQL([]));
}
public function testReturnsSmallIntTypeDeclarationSQL()
{
self::assertSame(
'SMALLSERIAL',
$this->platform->getSmallIntTypeDeclarationSQL(['autoincrement' => true])
);
self::assertSame(
'SMALLINT',
$this->platform->getSmallIntTypeDeclarationSQL(['autoincrement' => false])
);
self::assertSame(
'SMALLINT',
$this->platform->getSmallIntTypeDeclarationSQL([])
);
}
/**
* @group DBAL-553
*/
public function testInitializesJsonTypeMapping()
{
self::assertTrue($this->platform->hasDoctrineTypeMappingFor('json'));
self::assertEquals(Type::JSON, $this->platform->getDoctrineTypeMapping('json'));
}
/**
* @group DBAL-1220
*/
public function testReturnsCloseActiveDatabaseConnectionsSQL()
{
self::assertSame(
"SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = 'foo'",
$this->platform->getCloseActiveDatabaseConnectionsSQL('foo')
);
}
}
......@@ -5,7 +5,7 @@ namespace Doctrine\Tests\DBAL\Platforms;
use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
use Doctrine\DBAL\Types\Type;
class PostgreSQL94PlatformTest extends PostgreSQL92PlatformTest
class PostgreSQL94PlatformTest extends PostgreSqlPlatformTest
{
/**
* {@inheritdoc}
......
......@@ -3,6 +3,7 @@
namespace Doctrine\Tests\DBAL\Platforms;
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
use Doctrine\DBAL\Types\Type;
class PostgreSqlPlatformTest extends AbstractPostgreSqlPlatformTestCase
{
......@@ -15,4 +16,66 @@ class PostgreSqlPlatformTest extends AbstractPostgreSqlPlatformTestCase
{
self::assertTrue($this->platform->supportsPartialIndexes());
}
public function testColumnCollationDeclarationSQL()
{
self::assertEquals(
'COLLATE "en_US.UTF-8"',
$this->platform->getColumnCollationDeclarationSQL('en_US.UTF-8')
);
}
/**
* @group DBAL-553
*/
public function testHasNativeJsonType()
{
self::assertTrue($this->platform->hasNativeJsonType());
}
/**
* @group DBAL-553
*/
public function testReturnsJsonTypeDeclarationSQL()
{
self::assertSame('JSON', $this->platform->getJsonTypeDeclarationSQL([]));
}
public function testReturnsSmallIntTypeDeclarationSQL()
{
self::assertSame(
'SMALLSERIAL',
$this->platform->getSmallIntTypeDeclarationSQL(['autoincrement' => true])
);
self::assertSame(
'SMALLINT',
$this->platform->getSmallIntTypeDeclarationSQL(['autoincrement' => false])
);
self::assertSame(
'SMALLINT',
$this->platform->getSmallIntTypeDeclarationSQL([])
);
}
/**
* @group DBAL-553
*/
public function testInitializesJsonTypeMapping()
{
self::assertTrue($this->platform->hasDoctrineTypeMappingFor('json'));
self::assertEquals(Type::JSON, $this->platform->getDoctrineTypeMapping('json'));
}
/**
* @group DBAL-1220
*/
public function testReturnsCloseActiveDatabaseConnectionsSQL()
{
self::assertSame(
"SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = 'foo'",
$this->platform->getCloseActiveDatabaseConnectionsSQL('foo')
);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment