MigrationHelper: Move notification backfilling to own module.

This commit is contained in:
lain 2020-06-09 09:20:55 +02:00
parent 3b5282bef2
commit e1bc37d118
3 changed files with 5 additions and 5 deletions

View file

@ -2,7 +2,7 @@
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only # SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.MigrationHelper do defmodule Pleroma.MigrationHelper.NotificationBackfill do
alias Pleroma.Notification alias Pleroma.Notification
alias Pleroma.Object alias Pleroma.Object
alias Pleroma.Repo alias Pleroma.Repo

View file

@ -2,7 +2,7 @@ defmodule Pleroma.Repo.Migrations.BackfillNotificationTypes do
use Ecto.Migration use Ecto.Migration
def up do def up do
Pleroma.MigrationHelper.fill_in_notification_types() Pleroma.MigrationHelper.NotificationBackfill.fill_in_notification_types()
end end
def down do def down do

View file

@ -2,11 +2,11 @@
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only # SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.MigrationHelperTest do defmodule Pleroma.MigrationHelper.NotificationBackfillTest do
use Pleroma.DataCase use Pleroma.DataCase
alias Pleroma.Activity alias Pleroma.Activity
alias Pleroma.MigrationHelper alias Pleroma.MigrationHelper.NotificationBackfill
alias Pleroma.Notification alias Pleroma.Notification
alias Pleroma.Repo alias Pleroma.Repo
alias Pleroma.Web.CommonAPI alias Pleroma.Web.CommonAPI
@ -35,7 +35,7 @@ defmodule Pleroma.MigrationHelperTest do
assert {5, nil} = Repo.update_all(Notification, set: [type: nil]) assert {5, nil} = Repo.update_all(Notification, set: [type: nil])
MigrationHelper.fill_in_notification_types() NotificationBackfill.fill_in_notification_types()
assert %{type: "mention"} = assert %{type: "mention"} =
Repo.get_by(Notification, user_id: other_user.id, activity_id: post.id) Repo.get_by(Notification, user_id: other_user.id, activity_id: post.id)