1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Repo.Migrations.MigrateOldBookmarks do
15 where: u.local == true,
16 where: fragment("array_length(?, 1)", u.bookmarks) > 0,
17 select: %{id: u.id, bookmarks: u.bookmarks}
21 |> Enum.each(fn %{id: user_id, bookmarks: bookmarks} ->
22 Enum.each(bookmarks, fn ap_id ->
25 |> Activity.create_by_object_ap_id()
28 unless is_nil(activity), do: {:ok, _} = Bookmark.create(user_id, activity.id)
32 alter table(:users) do
38 alter table(:users) do
39 add(:bookmarks, {:array, :string}, null: false, default: [])