Merge branch 'develop' into 'from/upstream-develop/tusooa/edits'
# Conflicts: # lib/pleroma/constants.ex
This commit is contained in:
commit
4edc867b87
49 changed files with 1890 additions and 56 deletions
|
|
@ -0,0 +1,37 @@
|
|||
defmodule Pleroma.Repo.Migrations.UploadFilterExiftoolToExiftoolStripLocation do
|
||||
use Ecto.Migration
|
||||
|
||||
alias Pleroma.ConfigDB
|
||||
|
||||
def up,
|
||||
do:
|
||||
ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Upload})
|
||||
|> update_filtername(
|
||||
Pleroma.Upload.Filter.Exiftool,
|
||||
Pleroma.Upload.Filter.Exiftool.StripLocation
|
||||
)
|
||||
|
||||
def down,
|
||||
do:
|
||||
ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Upload})
|
||||
|> update_filtername(
|
||||
Pleroma.Upload.Filter.Exiftool.StripLocation,
|
||||
Pleroma.Upload.Filter.Exiftool
|
||||
)
|
||||
|
||||
defp update_filtername(%{value: value}, from_filtername, to_filtername) do
|
||||
new_value =
|
||||
value
|
||||
|> Keyword.update(:filters, [], fn filters ->
|
||||
filters
|
||||
|> Enum.map(fn
|
||||
^from_filtername -> to_filtername
|
||||
filter -> filter
|
||||
end)
|
||||
end)
|
||||
|
||||
ConfigDB.update_or_create(%{group: :pleroma, key: Pleroma.Upload, value: new_value})
|
||||
end
|
||||
|
||||
defp update_filtername(_, _, _), do: nil
|
||||
end
|
||||
26
priv/repo/migrations/20220308012601_create_announcements.exs
Normal file
26
priv/repo/migrations/20220308012601_create_announcements.exs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
defmodule Pleroma.Repo.Migrations.CreateAnnouncements do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
create_if_not_exists table(:announcements, primary_key: false) do
|
||||
add(:id, :uuid, primary_key: true)
|
||||
add(:data, :map)
|
||||
add(:starts_at, :naive_datetime)
|
||||
add(:ends_at, :naive_datetime)
|
||||
add(:rendered, :map)
|
||||
|
||||
timestamps()
|
||||
end
|
||||
|
||||
create_if_not_exists table(:announcement_read_relationships) do
|
||||
add(:user_id, references(:users, type: :uuid, on_delete: :delete_all))
|
||||
add(:announcement_id, references(:announcements, type: :uuid, on_delete: :delete_all))
|
||||
|
||||
timestamps(updated_at: false)
|
||||
end
|
||||
|
||||
create_if_not_exists(
|
||||
unique_index(:announcement_read_relationships, [:user_id, :announcement_id])
|
||||
)
|
||||
end
|
||||
end
|
||||
17
priv/repo/migrations/20220506175506_add_index_hotspots.exs
Normal file
17
priv/repo/migrations/20220506175506_add_index_hotspots.exs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# Pleroma: A lightweight social networking server
|
||||
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule Pleroma.Repo.Migrations.AddIndexHotspots do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
# Stop inserts into activities from doing a full-table scan of users:
|
||||
create_if_not_exists(index(:users, [:ap_id, "COALESCE(follower_address, '')"]))
|
||||
|
||||
# Change two indexes and a filter recheck into one index scan:
|
||||
create_if_not_exists(index(:following_relationships, [:follower_id, :state]))
|
||||
|
||||
create_if_not_exists(index(:notifications, [:user_id, :seen]))
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue