diff --git a/core/Migrations/Version13000Date20170718121200.php b/core/Migrations/Version13000Date20170718121200.php index c485e025c37..3985bdaeb57 100644 --- a/core/Migrations/Version13000Date20170718121200.php +++ b/core/Migrations/Version13000Date20170718121200.php @@ -5,7 +5,6 @@ */ namespace OC\Core\Migrations; -use Doctrine\DBAL\Platforms\PostgreSQL94Platform; use OCP\DB\ISchemaWrapper; use OCP\DB\Types; use OCP\IDBConnection; @@ -238,7 +237,7 @@ class Version13000Date20170718121200 extends SimpleMigrationStep { $table->addIndex(['name'], 'fs_name_hash'); $table->addIndex(['mtime'], 'fs_mtime'); $table->addIndex(['size'], 'fs_size'); - if (!$schema->getDatabasePlatform() instanceof PostgreSQL94Platform) { + if ($this->connection->getDatabaseProvider() !== IDBConnection::PLATFORM_POSTGRES) { $table->addIndex(['storage', 'path'], 'fs_storage_path_prefix', [], ['lengths' => [null, 64]]); } } diff --git a/lib/private/DB/MigrationService.php b/lib/private/DB/MigrationService.php index 54257025de3..7bf074fb51d 100644 --- a/lib/private/DB/MigrationService.php +++ b/lib/private/DB/MigrationService.php @@ -7,7 +7,7 @@ namespace OC\DB; use Doctrine\DBAL\Platforms\OraclePlatform; -use Doctrine\DBAL\Platforms\PostgreSQL94Platform; +use Doctrine\DBAL\Platforms\PostgreSQLPlatform; use Doctrine\DBAL\Schema\Index; use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\SchemaException; @@ -599,7 +599,7 @@ class MigrationService { $indexName = strtolower($primaryKey->getName()); $isUsingDefaultName = $indexName === 'primary'; - if ($this->connection->getDatabasePlatform() instanceof PostgreSQL94Platform) { + if ($this->connection->getDatabasePlatform() instanceof PostgreSQLPlatform) { $defaultName = $table->getName() . '_pkey'; $isUsingDefaultName = strtolower($defaultName) === $indexName; diff --git a/lib/private/DB/QueryBuilder/QueryBuilder.php b/lib/private/DB/QueryBuilder/QueryBuilder.php index 66ed88f03c8..48ed7b68718 100644 --- a/lib/private/DB/QueryBuilder/QueryBuilder.php +++ b/lib/private/DB/QueryBuilder/QueryBuilder.php @@ -9,7 +9,6 @@ namespace OC\DB\QueryBuilder; use Doctrine\DBAL\Platforms\MySQLPlatform; use Doctrine\DBAL\Platforms\OraclePlatform; -use Doctrine\DBAL\Platforms\PostgreSQL94Platform; use Doctrine\DBAL\Platforms\SQLitePlatform; use Doctrine\DBAL\Query\QueryException; use OC\DB\ConnectionAdapter; @@ -30,6 +29,7 @@ use OCP\DB\QueryBuilder\ILiteral; use OCP\DB\QueryBuilder\IParameter; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\DB\QueryBuilder\IQueryFunction; +use OCP\IDBConnection; use Psr\Log\LoggerInterface; class QueryBuilder implements IQueryBuilder { @@ -112,7 +112,7 @@ class QueryBuilder implements IQueryBuilder { if ($this->connection->getDatabasePlatform() instanceof OraclePlatform) { return new OCIExpressionBuilder($this->connection, $this); } - if ($this->connection->getDatabasePlatform() instanceof PostgreSQL94Platform) { + if ($this->connection->getDatabaseProvider() !== IDBConnection::PLATFORM_POSTGRES) { return new PgSqlExpressionBuilder($this->connection, $this); } if ($this->connection->getDatabasePlatform() instanceof MySQLPlatform) { @@ -148,7 +148,7 @@ class QueryBuilder implements IQueryBuilder { if ($this->connection->getDatabasePlatform() instanceof SQLitePlatform) { return new SqliteFunctionBuilder($this->connection, $this, $this->helper); } - if ($this->connection->getDatabasePlatform() instanceof PostgreSQL94Platform) { + if ($this->connection->getDatabaseProvider() === IDBConnection::PLATFORM_POSTGRES) { return new PgSqlFunctionBuilder($this->connection, $this, $this->helper); }