• 0 Posts
  • 10 Comments
Joined 1 year ago
cake
Cake day: June 15th, 2023

help-circle






  • Don’t delete from the local_user table. You only need to delete from the person table, the rest of the tables will be updated automatically and user count will update automatically.

    Edit: The below command will delete all unverified users. NOTE: If you do not have email verification turned on then all users are unverified, therefore all users will be deleted. It also appears with v18 when you enable email verification all existing users remain unverified.

    This is a destructive command, use at your own risk and don’t go fucking with the database if you don’t have backups.

    DELETE FROM person WHERE local = 'true' AND id IN (SELECT person_id FROM local_user WHERE email_verified = 'false');

    In the parenthesis you can add your AND to only select unverified accounts of a certain age.


  • Yes, person table is top level. Delete from person table and it cascades down and deletes from other tables. User count also automatically updates. Just be careful because person table also contains federated users. There is a “local” column to determine if they are local users or not.

    I had about 6k bot accounts, but they were all unverified, so I just deleted all local unverified accounts from the person table.

    Just don’t go messing with the database without backups. My host supports snapshots so I did a quick snapshot before messing with anything.