From: rinpatch Date: Mon, 29 Apr 2019 18:25:30 +0000 (+0300) Subject: Fix MigrateOldBookmarks migration crashing on deleted activities X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=f8f6af4cc1e9389023c04dba0984f523704f11b1;p=akkoma Fix MigrateOldBookmarks migration crashing on deleted activities --- diff --git a/priv/repo/migrations/20190414125034_migrate_old_bookmarks.exs b/priv/repo/migrations/20190414125034_migrate_old_bookmarks.exs index ebe69696e..134b7c6f7 100644 --- a/priv/repo/migrations/20190414125034_migrate_old_bookmarks.exs +++ b/priv/repo/migrations/20190414125034_migrate_old_bookmarks.exs @@ -18,7 +18,7 @@ defmodule Pleroma.Repo.Migrations.MigrateOldBookmarks do |> Enum.each(fn %{id: user_id, bookmarks: bookmarks} -> Enum.each(bookmarks, fn ap_id -> activity = Activity.get_create_by_object_ap_id(ap_id) - {:ok, _} = Bookmark.create(user_id, activity.id) + unless is_nil(activity), do: {:ok, _} = Bookmark.create(user_id, activity.id) end) end)