From 9517069a75e8212067a09f452a4de2e77ef55a70 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 17 Jul 2025 10:09:11 -0500 Subject: Add note to self for possible "improvement" in user deletion Add a note for considerations to make regarding recovery from error trying to delete users, so we can respond with more informative messages. Here, "improvement" is in quotes, because the priority leans more towards collecting more information for better feedback, which might be at the expense of speed of code. --- gn_auth/auth/authorisation/users/views.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gn_auth/auth/authorisation/users/views.py b/gn_auth/auth/authorisation/users/views.py index 2ad672d..5843393 100644 --- a/gn_auth/auth/authorisation/users/views.py +++ b/gn_auth/auth/authorisation/users/views.py @@ -611,6 +611,13 @@ def delete_users(): ("user_roles", "user_id"), ("user_verification_codes", "user_id")) for _table, _col in _dependent_tables: + # TODO: Figure out which of these tables leads to an + # IntegrityError when attempting to do a delete. + # Might have to use code with really dismal performance + # here in order to get more information on what fails + # and for whom. Maybe a try-catch, with the catch + # calling a function that loops through each user and + # table, collecting failure stats. cursor.execute( f"DELETE FROM {_table} WHERE {_col} IN ({_paramstr})", _delete) -- cgit v1.2.3