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}
18 |> Enum.each(fn user ->
19 Enum.each(user.old_bookmarks, fn id ->
20 activity = Activity.get_create_by_object_ap_id(id)
21 {:ok, _} = Bookmark.create(user.id, activity.id)
27 execute("TRUNCATE TABLE bookmarks")