Skip to content

Instantly share code, notes, and snippets.

@crakaC
Created February 8, 2021 09:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crakaC/65bade93a6f946aa657dfa215b530d04 to your computer and use it in GitHub Desktop.
Save crakaC/65bade93a6f946aa657dfa215b530d04 to your computer and use it in GitHub Desktop.
Mastodonでローカルユーザーからフォローされておらずトゥートが1つもローカルに保存されていないアカウントを削除する
Account.remote.where('id NOT IN (SELECT follows.target_account_id FROM follows WHERE follows.accoun
t_id IN (SELECT accounts.id FROM accounts WHERE accounts.domain IS NULL))').where('(SELECT COUNT(*) as c FROM status
es WHERE statuses.account_id = accounts.id) = 0').find_each{|e| DeleteAccountService.new.call(e,reserve_username: fa
lse, reserve_email: false)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment