forked from AkkomaGang/akkoma
FloatingGhost
98cb255d12
OTP builds to 1.15 Changelog entry Ensure policies are fully loaded Fix :warn use main branch for linkify Fix warn in tests Migrations for phoenix 1.17 Revert "Migrations for phoenix 1.17" This reverts commit 6a3b2f15b74ea5e33150529385215b7a531f3999. Oban upgrade Add default empty whitelist mix format limit test to amd64 OTP 26 tests for 1.15 use OTP_VERSION tag baka just 1.15 Massive deps update Update locale, deps Mix format shell???? multiline??? ? max cases 1 use assert_recieve don't put_env in async tests don't async conn/fs tests mix format FIx some uploader issues Fix tests
28 lines
734 B
Elixir
28 lines
734 B
Elixir
defmodule Pleroma.Repo.Migrations.AddFollowingAddressFromSourceData do
|
|
alias Pleroma.User
|
|
import Ecto.Query
|
|
require Logger
|
|
use Ecto.Migration
|
|
|
|
def change do
|
|
query =
|
|
User.Query.build(%{
|
|
external: true,
|
|
legacy_active: true,
|
|
order_by: :id
|
|
})
|
|
|> 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()
|
|
|
|
user ->
|
|
Logger.warning("User #{user.id} / #{user.nickname} does not seem to have source_data")
|
|
end)
|
|
end
|
|
end
|