1 defmodule Pleroma.Repo.Migrations.MigrateOldBookmarks do
12 where: u.local == true,
13 where: fragment("array_length(?, 1)", u.bookmarks) > 0,
14 select: %{id: u.id, bookmarks: u.bookmarks}
18 |> Enum.each(fn %{id: user_id, bookmarks: bookmarks} ->
19 Enum.each(bookmarks, fn ap_id ->
22 |> Activity.create_by_object_ap_id()
25 unless is_nil(activity), do: {:ok, _} = Bookmark.create(user_id, activity.id)
29 alter table(:users) do
35 alter table(:users) do
36 add(:bookmarks, {:array, :string}, null: false, default: [])