diff --git a/core/Application.php b/core/Application.php
index 28f2a435981d4..489e36f0f9468 100644
--- a/core/Application.php
+++ b/core/Application.php
@@ -31,6 +31,7 @@
*/
namespace OC\Core;
+use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
use OC\Authentication\Events\RemoteWipeFinished;
use OC\Authentication\Events\RemoteWipeStarted;
use OC\Authentication\Listeners\RemoteWipeActivityListener;
@@ -115,7 +116,7 @@ function (GenericEvent $event) use ($container) {
$subject->addHintForMissingSubject($table->getName(), 'fs_size');
}
- if (!$table->hasIndex('fs_storage_path_prefix')) {
+ if (!$table->hasIndex('fs_storage_path_prefix') && !$schema->getDatabasePlatform() instanceof PostgreSQL94Platform) {
$subject->addHintForMissingSubject($table->getName(), 'fs_storage_path_prefix');
}
}
diff --git a/core/Command/Db/AddMissingIndices.php b/core/Command/Db/AddMissingIndices.php
index 4a079c945c744..819026a6211c4 100644
--- a/core/Command/Db/AddMissingIndices.php
+++ b/core/Command/Db/AddMissingIndices.php
@@ -33,6 +33,7 @@
*/
namespace OC\Core\Command\Db;
+use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
use OC\DB\Connection;
use OC\DB\SchemaWrapper;
use OCP\IDBConnection;
@@ -144,7 +145,7 @@ private function addCoreIndexes(OutputInterface $output) {
$updated = true;
$output->writeln('Filecache table updated successfully.');
}
- if (!$table->hasIndex('fs_storage_path_prefix')) {
+ if (!$table->hasIndex('fs_storage_path_prefix') && !$schema->getDatabasePlatform() instanceof PostgreSQL94Platform) {
$output->writeln('Adding additional path index to the filecache table, this can take some time...');
$table->addIndex(['storage', 'path'], 'fs_storage_path_prefix', [], ['lengths' => [null, 64]]);
$this->connection->migrateToSchema($schema->getWrappedSchema());
diff --git a/core/Migrations/Version13000Date20170718121200.php b/core/Migrations/Version13000Date20170718121200.php
index b1a2eb6b2a687..7149f552eee63 100644
--- a/core/Migrations/Version13000Date20170718121200.php
+++ b/core/Migrations/Version13000Date20170718121200.php
@@ -31,6 +31,7 @@
*/
namespace OC\Core\Migrations;
+use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
use OCP\DB\Types;
use OCP\DB\ISchemaWrapper;
use OCP\IDBConnection;
@@ -263,7 +264,9 @@ public function changeSchema(IOutput $output, \Closure $schemaClosure, array $op
$table->addIndex(['storage', 'size', 'fileid'], 'fs_storage_size');
$table->addIndex(['mtime'], 'fs_mtime');
$table->addIndex(['size'], 'fs_size');
- $table->addIndex(['storage', 'path'], 'fs_storage_path_prefix', [], ['lengths' => [null, 64]]);
+ if (!$schema->getDatabasePlatform() instanceof PostgreSQL94Platform) {
+ $table->addIndex(['storage', 'path'], 'fs_storage_path_prefix', [], ['lengths' => [null, 64]]);
+ }
}
if (!$schema->hasTable('group_user')) {
diff --git a/lib/private/DB/SchemaWrapper.php b/lib/private/DB/SchemaWrapper.php
index e5f4656c9beda..40d41f0dafc8c 100644
--- a/lib/private/DB/SchemaWrapper.php
+++ b/lib/private/DB/SchemaWrapper.php
@@ -23,6 +23,8 @@
*/
namespace OC\DB;
+use Doctrine\DBAL\Exception;
+use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Schema\Schema;
use OCP\DB\ISchemaWrapper;
@@ -129,4 +131,15 @@ public function dropTable($tableName) {
public function getTables() {
return $this->schema->getTables();
}
+
+ /**
+ * Gets the DatabasePlatform for the database.
+ *
+ * @return AbstractPlatform
+ *
+ * @throws Exception
+ */
+ public function getDatabasePlatform() {
+ return $this->connection->getDatabasePlatform();
+ }
}
diff --git a/lib/public/DB/ISchemaWrapper.php b/lib/public/DB/ISchemaWrapper.php
index 2031f807e76bc..82e4205f1b36d 100644
--- a/lib/public/DB/ISchemaWrapper.php
+++ b/lib/public/DB/ISchemaWrapper.php
@@ -22,6 +22,9 @@
*/
namespace OCP\DB;
+use Doctrine\DBAL\Exception;
+use Doctrine\DBAL\Platforms\AbstractPlatform;
+
/**
* Interface ISchemaWrapper
*
@@ -81,7 +84,7 @@ public function getTables();
* @since 13.0.0
*/
public function getTableNames();
-
+
/**
* Gets all table names
*
@@ -89,4 +92,14 @@ public function getTableNames();
* @since 13.0.0
*/
public function getTableNamesWithoutPrefix();
+
+ /**
+ * Gets the DatabasePlatform for the database.
+ *
+ * @return AbstractPlatform
+ *
+ * @throws Exception
+ * @since 23.0.0
+ */
+ public function getDatabasePlatform();
}