Skip to content

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.

Deleting a User

  1. Run SQL query to identify user accounts. Record the id field for the user to delete. This will match the account id 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}
  2. Delete any transactions where the source_account_id or target_account_id value is the id from Step 1.
    • Query: DELETE FROM `bankingapp`.`transaction` WHERE (`source_account_id` = '{id}');
    • Query: DELETE FROM `bankingapp`.`transaction` WHERE (`target_account_id` = '{id}');
  3. Delete any tokens where the account_id value is the id from Step 1.
    • Query: DELETE FROM `bankingapp`.`token` WHERE (`account_id` = '{id}');
  4. Delete the account for the desired id.
    • Query: DELETE FROM `bankingapp`.`account` WHERE (`id` = '{id}');
  5. Delete the userfor the desired id.
    • Query: DELETE FROM `bankingapp`.`user` WHERE (`id` = '{id}');
Clone this wiki locally