-
Notifications
You must be signed in to change notification settings - Fork 172
Manually Editing MySQL Database
Chris edited this page Sep 11, 2024
·
1 revision
Manually editing the database is NOT recommended for functions with available REST API endpoints like registering a user, creating a PIN, or transactions. There are some cases where database functions are not supported in the REST API, for example deleting user, account, or transaction information from the database. This page will be updated with methods to manually update database entries within the database schema constraints.
- Run SQL query to identify user accounts. Record the
idfield for the user to delete. This will match the accountidfield in the current implementation where each user only has 1 matching account.- Query:
SELECT * FROM user; - Record
idnumber, further referred to as the placeholder {id}
- Query:
- Delete any transactions where the
source_account_idortarget_account_idvalue is theidfrom Step 1.- Query:
DELETE FROM `bankingapp`.`transaction` WHERE (`source_account_id` = '{id}'); - Query:
DELETE FROM `bankingapp`.`transaction` WHERE (`target_account_id` = '{id}');
- Query:
- Delete any tokens where the
account_idvalue is theidfrom Step 1.- Query:
DELETE FROM `bankingapp`.`token` WHERE (`account_id` = '{id}');
- Query:
- Delete the account for the desired
id.- Query:
DELETE FROM `bankingapp`.`account` WHERE (`id` = '{id}');
- Query:
- Delete the userfor the desired
id.- Query:
DELETE FROM `bankingapp`.`user` WHERE (`id` = '{id}');
- Query: