Skip to content
Snippets Groups Projects

Issue #3498178: The key_value_sorted table does not have primar key thus will...

1 file
+ 14
0
Compare changes
  • Side-by-side
  • Inline
+ 14
0
<?php
use Drupal\Core\StringTranslation\TranslatableMarkup;
/**
* Implements hook_schema().
*/
@@ -33,6 +35,18 @@ function key_value_schema() {
'collection_name' => ['collection', 'name'],
'name' => ['name'],
],
'primary key' => ['collection', 'name'],
];
return $schema;
}
/**
* Add primary key to work with the READ COMMITTED transaction isolation level.
* @see https://www.drupal.org/docs/getting-started/system-requirements/setting-the-mysql-transaction-isolation-level
*/
function key_value_update_10100(&$sandbox = NULL): TranslatableMarkup {
$schema = \Drupal::database()->schema();
// Add primary key.
$schema->addPrimaryKey('key_value_sorted', ['collection', 'name']);
return \t('Added primary key to the key_value_sorted table.');
}
Loading