Updated sql queries in `on_delete` & `on_complete`