Unverified Commit c758df9b authored by alexpott's avatar alexpott

Issue #2925318 by phenaproxima, fgm, jungle, Kristen Pol, Berdir: Redundant...

Issue #2925318 by phenaproxima, fgm, jungle, Kristen Pol, Berdir: Redundant index sid on locales_translation
parent d7300cc3
......@@ -183,7 +183,6 @@ function locale_schema() {
],
],
'indexes' => [
'string_id' => ['sid'],
'string_type' => ['sid', 'type'],
],
];
......@@ -308,6 +307,17 @@ function locale_requirements($phase) {
return $requirements;
}
/**
* Delete an unnecessary index on the locales_location table.
*/
function locale_update_9101() {
$schema = \Drupal::database()->schema();
$table = 'locales_location';
if ($schema->indexExists($table, 'string_id')) {
$schema->dropIndex($table, 'string_id');
}
}
/**
* Implements hook_update_last_removed().
*/
......
<?php
namespace Drupal\Tests\locale\Functional;
use Drupal\Core\Database\Database;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
/**
* Tests Locale's update path.
*
* @group locale
*/
class LocaleUpdatePathTest extends UpdatePathTestBase {
/**
* {@inheritdoc}
*/
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
dirname(__DIR__, 4) . '/system/tests/fixtures/update/drupal-8.8.0.filled.standard.php.gz',
];
}
/**
* Tests Locale's update path.
*/
public function testUpdatePath() {
$schema = Database::getConnection()->schema();
$this->assertTrue($schema->indexExists('locales_location', 'string_id'));
$this->assertTrue($schema->indexExists('locales_location', 'string_type'));
$this->runUpdates();
$this->assertFalse($schema->indexExists('locales_location', 'string_id'));
$this->assertTrue($schema->indexExists('locales_location', 'string_type'));
}
}
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