From: Phenethylamine Date: Thu, 12 Apr 2018 06:43:48 +0000 (-0400) Subject: Add rm_user mix task X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=4478b9115c088c637721ed2c3255222ec4cf54e2;p=akkoma Add rm_user mix task --- diff --git a/lib/mix/tasks/rm_user.ex b/lib/mix/tasks/rm_user.ex new file mode 100644 index 000000000..30196d502 --- /dev/null +++ b/lib/mix/tasks/rm_user.ex @@ -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