-
Notifications
You must be signed in to change notification settings - Fork 99
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
id
field for the user to delete. This will match the accountid
field in the current implementation where each user only has 1 matching account.- Query:
SELECT * FROM user;
- Record
id
number, further referred to as the placeholder {id}
- Query:
- Delete any transactions where the
source_account_id
ortarget_account_id
value is theid
from 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_id
value is theid
from 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: