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
1 changed files with 26 additions and 0 deletions

View File

@ -135,4 +135,30 @@ defmodule Mix.Tasks.Pleroma.Database do
end)
|> Stream.run()
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