Add rm_user mix task

This commit is contained in:
Phenethylamine 2018-04-12 02:43:48 -04:00
parent 3d636cf533
commit 4478b9115c

14
lib/mix/tasks/rm_user.ex Normal file
View file

@ -0,0 +1,14 @@
defmodule Mix.Tasks.RmUser do
use Mix.Task
import Mix.Ecto
alias Pleroma.{Repo, User}
@shortdoc "Permanently delete a user"
def run([nickname]) do
ensure_started(Repo, [])
with %User{local: true} = user <- User.get_by_nickname(nickname) do
Repo.delete!(user)
end
end
end