Account deletion on self-hosted instance
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?
There's no single public API/SQL command afaik. For now best option would be to use an SQL client to delete the entries.
Note: use this under your own risk.
Steps:
- backup your data first!
docker-compose exec db sh -c 'MYSQL_PWD=$MYSQL_ROOT_PASSWORD mysqldump $MYSQL_DATABASE' -- > backup.sql - spawn a mysql shell via
docker-compose exec db sh -c 'MYSQL_PWD=$MYSQL_ROOT_PASSWORD mysql $MYSQL_DATABASE'. - (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>");
- (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>") );
- Delete Notes
DELETE FROM items WHERE user_uuid = (SELECT uuid FROM users WHERE email= "<YOUR_EMAIL>");
- Delete Login Sessions
DELETE FROM sessions WHERE user_uuid = (SELECT uuid FROM users WHERE email= "<YOUR_EMAIL>");
- Final Step. Delete User
DELETE FROM users WHERE email= "<YOUR_EMAIL>";
+1 this should work with the native 'delete account' button in client apps