Merge branch 'develop' into feature/database-compaction
[akkoma] / lib / mix / tasks / compact_database.ex
index b84b340acea8f4d8043182abc06cd328407692c1..17b9721f72b5db5a2f6341bb55b3365ad762a48e 100644 (file)
@@ -6,9 +6,9 @@ defmodule Mix.Tasks.CompactDatabase do
   require Logger
 
   use Mix.Task
-  import Mix.Ecto
   import Ecto.Query
-  alias Pleroma.{Repo, Object, Activity}
+  alias Pleroma.Activity
+  alias Pleroma.Repo
 
   defp maybe_compact(%Activity{data: %{"object" => %{"id" => object_id}}} = activity) do
     data =
@@ -33,15 +33,15 @@ defmodule Mix.Tasks.CompactDatabase do
     )
   end
 
-  def run(args) do
+  def run(_args) do
     Application.ensure_all_started(:pleroma)
 
     max = Repo.aggregate(Activity, :max, :id)
     Logger.info("Considering #{max} activities")
 
-    chunks = 0..(round(max / 100))
+    chunks = 0..round(max / 100)
 
-    Enum.each(chunks, fn (i) ->
+    Enum.each(chunks, fn i ->
       min = i * 100
       max = min + 100