Merge remote-tracking branch 'origin/develop' into reactions
This commit is contained in:
commit
73b6512907
52 changed files with 800 additions and 309 deletions
|
|
@ -3,22 +3,6 @@ defmodule Pleroma.Repo.Migrations.CopyMutedToMutedNotifications do
|
|||
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)
|
||||
execute("update users set info = jsonb_set(info, '{muted_notifications}', info->'mutes', true) where local = true")
|
||||
end
|
||||
end
|
||||
|
|
|
|||
9
priv/repo/migrations/20191006123824_add_keys_column.exs
Normal file
9
priv/repo/migrations/20191006123824_add_keys_column.exs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
defmodule Pleroma.Repo.Migrations.AddKeysColumn do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
alter table("users") do
|
||||
add_if_not_exists :keys, :text
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
defmodule Pleroma.Repo.Migrations.MoveKeysToSeparateColumn do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
execute("update users set keys = info->>'keys' where local", "update users set info = jsonb_set(info, '{keys}'::text[], to_jsonb(keys)) where local")
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue