projects
/
akkoma
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a23df89
)
Permit easy access to vaccum full and analyze via a mix task
author
Mark Felder
<feld@FreeBSD.org>
Wed, 27 May 2020 21:27:07 +0000
(16:27 -0500)
committer
Mark Felder
<feld@FreeBSD.org>
Wed, 27 May 2020 21:27:07 +0000
(16:27 -0500)
lib/mix/tasks/pleroma/database.ex
patch
|
blob
|
history
diff --git
a/lib/mix/tasks/pleroma/database.ex
b/lib/mix/tasks/pleroma/database.ex
index 778de162f1687b7eadfbc1126bfa1c8f96e07b45..c4f343f04fa74978fbc764adfcffec6e97ac7dc7 100644
(file)
--- a/
lib/mix/tasks/pleroma/database.ex
+++ b/
lib/mix/tasks/pleroma/database.ex
@@
-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