Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions apps/dav/appinfo/Migrations/Version20170519091921.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
namespace OCA\dav\Migrations;

use Doctrine\DBAL\Schema\Schema;
use OCP\Migration\ISchemaMigration;

/**
* Add index to oc_cards to assist with searching with large numbers of rows
*/
class Version20170519091921 implements ISchemaMigration {

public function changeSchema(Schema $schema, array $options) {
$prefix = $options['tablePrefix'];
$table = $schema->getTable("${prefix}cards");
// Check for existing index spanning these columns
foreach ($table->getIndexes() as $index) {
// Check if we have a matching index already
if(empty(array_diff($index->getColumns(), ['uri', 'addressbookid']))) {
return;
}

}
// Add the index if we dont have one spanning this column already
$table->addIndex(['addressbookid', 'uri'], 'addressbookid_uri_index');
}

}