function externalauth_update_8102 in External Authentication 8
Same name and namespace in other branches
- 2.0.x externalauth.install \externalauth_update_8102()
Make index on authname+provider unique.
File
- ./
externalauth.install, line 87 - Install, update and uninstall functions for the externalauth module.
Code
function externalauth_update_8102() {
/** @var \Drupal\Core\Database\Schema $schema */
$schema = \Drupal::service('database')
->schema();
// This 'add' can potentially fail, if duplicate authnames are registered
// already. This is why we do it before the 'remove'. If this happens, the
// website maintainer is required to fix the table contents themselves.
$schema
->addUniqueKey('authmap', 'authname_provider', [
'authname',
'provider',
]);
$schema
->dropIndex('authmap', 'auth_provider');
}