summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2023-07-19 09:17:19 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2023-07-19 09:17:19 +0200
commit86ddfe5c97667651b5adc1d04f69963e85560864 (patch)
treeabc07f3675b287fd673036b90bf87abd85adfec4 /lib
parent2fecf8b6626888a6a41f6463b2ce792866a2e355 (diff)
Users->delete: delete relations as well1.33.6
Diffstat (limited to 'lib')
-rw-r--r--lib/Travelynx/Model/Users.pm20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/Travelynx/Model/Users.pm b/lib/Travelynx/Model/Users.pm
index c51e612..4b108d4 100644
--- a/lib/Travelynx/Model/Users.pm
+++ b/lib/Travelynx/Model/Users.pm
@@ -561,15 +561,17 @@ sub delete {
my %res;
- $res{tokens} = $db->delete( 'tokens', { user_id => $uid } );
- $res{stats} = $db->delete( 'journey_stats', { user_id => $uid } );
- $res{journeys} = $db->delete( 'journeys', { user_id => $uid } );
- $res{transit} = $db->delete( 'in_transit', { user_id => $uid } );
- $res{hooks} = $db->delete( 'webhooks', { user_id => $uid } );
- $res{trwl} = $db->delete( 'traewelling', { user_id => $uid } );
- $res{lt} = $db->delete( 'localtransit', { user_id => $uid } );
- $res{password} = $db->delete( 'pending_passwords', { user_id => $uid } );
- $res{users} = $db->delete( 'users', { id => $uid } );
+ $res{tokens} = $db->delete( 'tokens', { user_id => $uid } );
+ $res{stats} = $db->delete( 'journey_stats', { user_id => $uid } );
+ $res{journeys} = $db->delete( 'journeys', { user_id => $uid } );
+ $res{transit} = $db->delete( 'in_transit', { user_id => $uid } );
+ $res{hooks} = $db->delete( 'webhooks', { user_id => $uid } );
+ $res{trwl} = $db->delete( 'traewelling', { user_id => $uid } );
+ $res{lt} = $db->delete( 'localtransit', { user_id => $uid } );
+ $res{password} = $db->delete( 'pending_passwords', { user_id => $uid } );
+ $res{relations} = $db->delete( 'relations',
+ [ { subject_id => $uid }, { object_id => $uid } ] );
+ $res{users} = $db->delete( 'users', { id => $uid } );
for my $key ( keys %res ) {
$res{$key} = $res{$key}->rows;