Permit easy access to vaccum full and analyze via a mix task

This commit is contained in:
Mark Felder 2020-05-27 16:27:07 -05:00
parent a23df89b5d
commit a2f57bd82b

View file

@ -135,4 +135,30 @@ defmodule Mix.Tasks.Pleroma.Database do
end) end)
|> Stream.run() |> Stream.run()
end end
def run(["vacuum", args]) do
start_pleroma()
case args do
"analyze" ->
Logger.info("Runnning VACUUM ANALYZE.")
Repo.query!(
"vacuum analyze;",
[],
timeout: :infinity
)
"full" ->
Logger.info("Runnning VACUUM FULL. This could take a while.")
Repo.query!(
"vacuum full;",
[],
timeout: :infinity
)
_ ->
Logger.error("Error: invalid vacuum argument.")
end
end
end end