forked from YokaiRick/akkoma
saving following_address for existing users
This commit is contained in:
parent
f8786fa6f2
commit
936050257d
1 changed files with 20 additions and 0 deletions
|
@ -0,0 +1,20 @@
|
|||
defmodule Pleroma.Repo.Migrations.AddFollowingAddressFromSourceData do
|
||||
use Ecto.Migration
|
||||
import Ecto.Query
|
||||
alias Pleroma.User
|
||||
|
||||
def change do
|
||||
query =
|
||||
User.external_users_query()
|
||||
|> select([u], struct(u, [:id, :ap_id, :info]))
|
||||
|
||||
Pleroma.Repo.stream(query)
|
||||
|> Enum.each(fn
|
||||
%{info: %{source_data: source_data}} = user ->
|
||||
Ecto.Changeset.cast(user, %{following_address: source_data["following"]}, [
|
||||
:following_address
|
||||
])
|
||||
|> Pleroma.Repo.update()
|
||||
end)
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue