1 defmodule Pleroma.Repo.Migrations.MigrateOldBookmarks do
12 where: u.local == true,
13 where: fragment("array_length(?, 1)", u.old_bookmarks) > 0,
14 select: %{id: u.id, old_bookmarks: u.old_bookmarks}
17 Repo.transaction(fn ->
19 |> Enum.each(fn user ->
20 Enum.each(user.old_bookmarks, fn id ->
21 activity = Activity.get_create_by_object_ap_id(id)
22 {:ok, _} = Bookmark.create(user.id, activity.id)
29 execute("TRUNCATE TABLE bookmarks")