Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Account deletion on self-hosted instance #75

Open
TheEgghead27 opened this issue Jun 28, 2022 · 3 comments
Open

Account deletion on self-hosted instance #75

TheEgghead27 opened this issue Jun 28, 2022 · 3 comments
Labels
help wanted Extra attention is needed

Comments

@TheEgghead27
Copy link

Service Versions (please complete the following information):
Paste the output of ./server.sh version. For example:

 Container                             Repository                        Tag                 Image Id            Size
api-gateway-standalone                standardnotes/api-gateway         1.40.1              614ea1d3f64c        851MB
auth-standalone                       standardnotes/auth                1.46.2              6648d9486d27        928MB
auth-worker-standalone                standardnotes/auth                1.46.2              6648d9486d27        928MB
cache-standalone                      redis                             6.0-alpine          09401fed2a42        24.7MB
db-standalone                         mysql                             5.6                 dd3b2a5dcb48        303MB
files-standalone                      standardnotes/files               1.9.0               baa6121a09d1        1.05GB
syncing-server-js-standalone          standardnotes/syncing-server-js   1.54.1              2455980ced7d        973MB
syncing-server-js-worker-standalone   standardnotes/syncing-server-js   1.54.1              2455980ced7d        973MB

Describe the issue
Hello, I had accidentally registered an account on my self-hosted instance with a typo in the account's email, and I was wondering what the proper way to delete said account would be, since the Standard Notes client does not offer this, and the official Standard Notes instance uses its own separate page for account deletion. Is there an API endpoint or SQL command to completely delete an account's data, and if so, would it be possible for it to be documented?

@TheEgghead27 TheEgghead27 added the help wanted Extra attention is needed label Jun 28, 2022
@moughxyz
Copy link
Member

There's no single public API/SQL command afaik. For now best option would be to use an SQL client to delete the entries.

@jackyzy823
Copy link

jackyzy823 commented Aug 10, 2022

Note: use this under your own risk.

Steps:

  1. backup your data first! docker-compose exec db sh -c 'MYSQL_PWD=$MYSQL_ROOT_PASSWORD mysqldump $MYSQL_DATABASE' -- > backup.sql
  2. spawn a mysql shell via docker-compose exec db sh -c 'MYSQL_PWD=$MYSQL_ROOT_PASSWORD mysql $MYSQL_DATABASE'.
  3. (Optionally) If you created subscription.
DELETE FROM user_roles WHERE user_uuid = (SELECT uuid FROM users WHERE email="<YOUR_EMAIL>");
DELETE FROM user_subscriptions WHERE user_uuid = (SELECT uuid FROM users WHERE email="<YOUR_EMAIL>");
  1. (Optionally) Delete Note History(revisions) if exists
DELETE FROM revisions WHERE item_uuid IN ( SELECT uuid FROM  items WHERE user_uuid =  (SELECT uuid FROM users WHERE email= "<YOUR_EMAIL>") );
  1. Delete Notes
DELETE FROM items WHERE user_uuid =  (SELECT uuid FROM users WHERE email= "<YOUR_EMAIL>");
  1. Delete Login Sessions
DELETE FROM sessions WHERE user_uuid =  (SELECT uuid FROM users WHERE email= "<YOUR_EMAIL>");
  1. Final Step. Delete User
DELETE FROM users WHERE email= "<YOUR_EMAIL>";

@kzshantonu
Copy link

+1 this should work with the native 'delete account' button in client apps

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants