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