From d185ea19dc12d6375c244676bfefc331dc608139 Mon Sep 17 00:00:00 2001
From: catch <catch@35733.no-reply.drupal.org>
Date: Tue, 22 Feb 2022 12:53:10 +0000
Subject: [PATCH] Issue #3265802 by daffie, alexpott: user_update_9301() causes
 data loss and a broken site on SQL Server

---
 core/modules/user/user.install | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/core/modules/user/user.install b/core/modules/user/user.install
index c9aa52936ae7..b162d6b4afff 100644
--- a/core/modules/user/user.install
+++ b/core/modules/user/user.install
@@ -109,6 +109,10 @@ function user_update_9301(&$sandbox) {
   }
 
   $connection = \Drupal::database();
+  if ($connection->databaseType() === 'sqlsrv') {
+    return t('The Microsoft SQL Server does not support user_update_9301() because it causes data loss.');
+  }
+
   $connection->schema()->dropPrimaryKey('users');
   if ($connection->databaseType() === 'mysql') {
     $sql_mode = $connection->query("SELECT @@sql_mode;")->fetchField();
-- 
GitLab