Merge remote-tracking branch 'pleroma/develop' into feature/addressable-lists
This commit is contained in:
commit
64a946643e
75 changed files with 2247 additions and 1365 deletions
|
|
@ -0,0 +1,9 @@
|
|||
defmodule Pleroma.Repo.Migrations.AddFollowingAddressToUser do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
alter table(:users) do
|
||||
add(:following_address, :string, unique: true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
defmodule Pleroma.Repo.Migrations.AddFollowingAddressIndexToUser do
|
||||
use Ecto.Migration
|
||||
|
||||
@disable_ddl_transaction true
|
||||
def change do
|
||||
create(index(:users, [:following_address], concurrently: true))
|
||||
end
|
||||
end
|
||||
|
|
@ -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
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
defmodule Pleroma.Repo.Migrations.CopyMutedToMutedNotifications do
|
||||
use Ecto.Migration
|
||||
alias Pleroma.User
|
||||
|
||||
def change do
|
||||
query =
|
||||
User.Query.build(%{
|
||||
local: true,
|
||||
active: true,
|
||||
order_by: :id
|
||||
})
|
||||
|
||||
Pleroma.Repo.stream(query)
|
||||
|> Enum.each(fn
|
||||
%{info: %{mutes: mutes} = info} = user ->
|
||||
info_cng =
|
||||
Ecto.Changeset.cast(info, %{muted_notifications: mutes}, [:muted_notifications])
|
||||
|
||||
Ecto.Changeset.change(user)
|
||||
|> Ecto.Changeset.put_embed(:info, info_cng)
|
||||
|> Pleroma.Repo.update()
|
||||
end)
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue