summaryrefslogtreecommitdiff
path: root/priv/repo/migrations/20171109114020_fill_actor_field.exs
diff options
context:
space:
mode:
authorrinpatch <rinpatch@sdf.org>2019-10-08 15:16:39 +0300
committerrinpatch <rinpatch@sdf.org>2019-10-08 15:16:39 +0300
commit32808208bef12996f819d21ca2635837aff98cbf (patch)
tree677e6798940b76be29771a9a574f544772c52e6b /priv/repo/migrations/20171109114020_fill_actor_field.exs
parent44e0c5cabb157fe2cfc66af0167547ac51f98ff0 (diff)
downloadpleroma-32808208bef12996f819d21ca2635837aff98cbf.tar.gz
pleroma-32808208bef12996f819d21ca2635837aff98cbf.zip
Enable `mix format` for migrations
Diffstat (limited to 'priv/repo/migrations/20171109114020_fill_actor_field.exs')
-rw-r--r--priv/repo/migrations/20171109114020_fill_actor_field.exs9
1 files changed, 5 insertions, 4 deletions
diff --git a/priv/repo/migrations/20171109114020_fill_actor_field.exs b/priv/repo/migrations/20171109114020_fill_actor_field.exs
index 255ca46d5..fb7eca692 100644
--- a/priv/repo/migrations/20171109114020_fill_actor_field.exs
+++ b/priv/repo/migrations/20171109114020_fill_actor_field.exs
@@ -5,17 +5,19 @@ defmodule Pleroma.Repo.Migrations.FillActorField do
def up do
max = Repo.aggregate(Activity, :max, :id)
+
if max do
IO.puts("#{max} activities")
- chunks = 0..(round(max / 10_000))
+ chunks = 0..round(max / 10_000)
- Enum.each(chunks, fn (i) ->
+ Enum.each(chunks, fn i ->
min = i * 10_000
max = min + 10_000
+
execute("""
update activities set actor = data->>'actor' where id > #{min} and id <= #{max};
""")
- |> IO.inspect
+ |> IO.inspect()
end)
end
end
@@ -23,4 +25,3 @@ defmodule Pleroma.Repo.Migrations.FillActorField do
def down do
end
end
-