mirror of
https://github.com/nextcloud/server.git
synced 2026-06-08 08:16:43 -04:00
Merge pull request #29325 from nextcloud/backport/28541/stable21
This commit is contained in:
commit
064f2615d7
5 changed files with 44 additions and 1 deletions
|
|
@ -32,6 +32,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,6 +116,10 @@ class Application extends App {
|
|||
if (!$table->hasIndex('fs_size')) {
|
||||
$subject->addHintForMissingSubject($table->getName(), 'fs_size');
|
||||
}
|
||||
|
||||
if (!$table->hasIndex('fs_storage_path_prefix') && !$schema->getDatabasePlatform() instanceof PostgreSQL94Platform) {
|
||||
$subject->addHintForMissingSubject($table->getName(), 'fs_storage_path_prefix');
|
||||
}
|
||||
}
|
||||
|
||||
if ($schema->hasTable('twofactor_providers')) {
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OC\Core\Command\Db;
|
||||
|
||||
use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
|
||||
use OC\DB\Connection;
|
||||
use OC\DB\SchemaWrapper;
|
||||
use OCP\IDBConnection;
|
||||
|
|
@ -144,6 +145,13 @@ class AddMissingIndices extends Command {
|
|||
$updated = true;
|
||||
$output->writeln('<info>Filecache table updated successfully.</info>');
|
||||
}
|
||||
if (!$table->hasIndex('fs_storage_path_prefix') && !$schema->getDatabasePlatform() instanceof PostgreSQL94Platform) {
|
||||
$output->writeln('<info>Adding additional path index to the filecache table, this can take some time...</info>');
|
||||
$table->addIndex(['storage', 'path'], 'fs_storage_path_prefix', [], ['lengths' => [null, 64]]);
|
||||
$this->connection->migrateToSchema($schema->getWrappedSchema());
|
||||
$updated = true;
|
||||
$output->writeln('<info>Filecache table updated successfully.</info>');
|
||||
}
|
||||
}
|
||||
|
||||
$output->writeln('<info>Check indices of the twofactor_providers table.</info>');
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
namespace OC\Core\Migrations;
|
||||
|
||||
use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
|
||||
use OCP\DB\Types;
|
||||
use OCP\DB\ISchemaWrapper;
|
||||
use OCP\IDBConnection;
|
||||
|
|
@ -262,6 +263,9 @@ class Version13000Date20170718121200 extends SimpleMigrationStep {
|
|||
$table->addIndex(['storage', 'size', 'fileid'], 'fs_storage_size');
|
||||
$table->addIndex(['mtime'], 'fs_mtime');
|
||||
$table->addIndex(['size'], 'fs_size');
|
||||
if (!$schema->getDatabasePlatform() instanceof PostgreSQL94Platform) {
|
||||
$table->addIndex(['storage', 'path'], 'fs_storage_path_prefix', [], ['lengths' => [null, 64]]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$schema->hasTable('group_user')) {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
namespace OC\DB;
|
||||
|
||||
use Doctrine\DBAL\Exception;
|
||||
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use OCP\DB\ISchemaWrapper;
|
||||
|
||||
|
|
@ -130,4 +132,15 @@ class SchemaWrapper implements ISchemaWrapper {
|
|||
public function getTables() {
|
||||
return $this->schema->getTables();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the DatabasePlatform for the database.
|
||||
*
|
||||
* @return AbstractPlatform
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getDatabasePlatform() {
|
||||
return $this->connection->getDatabasePlatform();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@
|
|||
|
||||
namespace OCP\DB;
|
||||
|
||||
use Doctrine\DBAL\Exception;
|
||||
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||
|
||||
/**
|
||||
* Interface ISchemaWrapper
|
||||
*
|
||||
|
|
@ -82,7 +85,7 @@ interface ISchemaWrapper {
|
|||
* @since 13.0.0
|
||||
*/
|
||||
public function getTableNames();
|
||||
|
||||
|
||||
/**
|
||||
* Gets all table names
|
||||
*
|
||||
|
|
@ -90,4 +93,14 @@ interface ISchemaWrapper {
|
|||
* @since 13.0.0
|
||||
*/
|
||||
public function getTableNamesWithoutPrefix();
|
||||
|
||||
/**
|
||||
* Gets the DatabasePlatform for the database.
|
||||
*
|
||||
* @return AbstractPlatform
|
||||
*
|
||||
* @throws Exception
|
||||
* @since 21.0.8
|
||||
*/
|
||||
public function getDatabasePlatform();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue