summaryrefslogtreecommitdiff
path: root/app/Services
diff options
context:
space:
mode:
authorGreg Roach <greg@subaqua.co.uk>2026-04-09 14:40:01 +0100
committerGreg Roach <greg@subaqua.co.uk>2026-04-09 14:40:01 +0100
commit6966db16a6e63a69eb9c3aaf699b55f590e1fa77 (patch)
tree844ef0fd2a781e19fea3013924232baa0225a7f5 /app/Services
parentc338276a5a7c4a754857e3c406cde67e852be621 (diff)
downloadwebtrees-6966db16a6e63a69eb9c3aaf699b55f590e1fa77.tar.gz
webtrees-6966db16a6e63a69eb9c3aaf699b55f590e1fa77.tar.bz2
webtrees-6966db16a6e63a69eb9c3aaf699b55f590e1fa77.zip
Fix: #5329 - SQL-Server cannot handle complicated foreign keys
Diffstat (limited to 'app/Services')
-rw-r--r--app/Services/UserService.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/Services/UserService.php b/app/Services/UserService.php
index e51af70596..fb691fc90a 100644
--- a/app/Services/UserService.php
+++ b/app/Services/UserService.php
@@ -310,6 +310,13 @@ class UserService
DB::table('user_gedcom_setting')->where('user_id', '=', $user->id())->delete();
DB::table('user_setting')->where('user_id', '=', $user->id())->delete();
DB::table('message')->where('user_id', '=', $user->id())->delete();
+
+ if (DB::driverName() === DB::SQL_SERVER) {
+ // SQL-Server cannot handle these foreign key constraints.
+ DB::table('gedcom')->where('contact_user_id', '=', $user->id())->update(['contact_user_id' => null]);
+ DB::table('gedcom')->where('support_user_id', '=', $user->id())->update(['support_user_id' => null]);
+ }
+
DB::table('user')->where('user_id', '=', $user->id())->delete();
}