From the admin, if I delete a user they disappear from the admin list but not from the `users` database table.

Looking through the code I can see `UsersService.php` has a function `deleteUser` which calls the `deleteElementById` from `ElementsService.php` - but it does not seem to actually remove the user from the main users table at all.

The version of craft in use has recently been updated to 2.9.2 following the Craft CMS guide and I've read there maybe Foreign Key issues in the database, but the fixes (plugins) seem to only be for Craft 3, and we are unable to upgrade at this time.

Also looked at > https://craftcms.stackexchange.com/q/15393

But as this did not have a full answer and is not a fix for the CMS side of things it's not viable.

How can I determine 1) where the issue is, and 2) how to resolve it?