Merge pull request 'Purge leftovers from chats' (#684) from Oneric/akkoma:cosmetic-purge-chat into develop
Reviewed-on: #684
This commit is contained in:
commit
6fde75e1f0
3 changed files with 50 additions and 7 deletions
|
@ -290,7 +290,6 @@
|
||||||
alwaysShowSubjectInput: true,
|
alwaysShowSubjectInput: true,
|
||||||
background: "/images/city.jpg",
|
background: "/images/city.jpg",
|
||||||
collapseMessageWithSubject: false,
|
collapseMessageWithSubject: false,
|
||||||
disableChat: false,
|
|
||||||
greentext: false,
|
greentext: false,
|
||||||
hideFilteredStatuses: false,
|
hideFilteredStatuses: false,
|
||||||
hideMutedPosts: false,
|
hideMutedPosts: false,
|
||||||
|
@ -453,10 +452,6 @@
|
||||||
image_quality: 85,
|
image_quality: 85,
|
||||||
min_content_length: 100 * 1024
|
min_content_length: 100 * 1024
|
||||||
|
|
||||||
config :pleroma, :shout,
|
|
||||||
enabled: true,
|
|
||||||
limit: 5_000
|
|
||||||
|
|
||||||
config :phoenix, :format_encoders, json: Jason, "activity+json": Jason
|
config :phoenix, :format_encoders, json: Jason, "activity+json": Jason
|
||||||
|
|
||||||
config :phoenix, :json_library, Jason
|
config :phoenix, :json_library, Jason
|
||||||
|
|
50
priv/repo/migrations/20240210000000_drop_chat_tables.exs
Normal file
50
priv/repo/migrations/20240210000000_drop_chat_tables.exs
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
defmodule Pleroma.Repo.Migrations.DropChatTables do
|
||||||
|
use Ecto.Migration
|
||||||
|
|
||||||
|
def up do
|
||||||
|
# Automatically drops associated indices and constraints
|
||||||
|
drop table(:chat_message_references)
|
||||||
|
drop table(:chats)
|
||||||
|
end
|
||||||
|
|
||||||
|
def down do
|
||||||
|
# Ecto's default primary key is bigserial, thus configure manually
|
||||||
|
create table(:chats, primary_key: false) do
|
||||||
|
add(:id, :uuid, primary_key: true, autogenerated: true)
|
||||||
|
|
||||||
|
add(
|
||||||
|
:user_id,
|
||||||
|
references(:users, type: :uuid, on_delete: :delete_all)
|
||||||
|
# yes, this was nullable
|
||||||
|
)
|
||||||
|
|
||||||
|
add(
|
||||||
|
:recipient,
|
||||||
|
references(:users, column: :ap_id, type: :string, on_delete: :delete_all)
|
||||||
|
# yes, this was nullable
|
||||||
|
)
|
||||||
|
|
||||||
|
timestamps()
|
||||||
|
end
|
||||||
|
|
||||||
|
create(index(:chats, [:user_id, :recipient], unique: true))
|
||||||
|
|
||||||
|
create table(:chat_message_references, primary_key: false) do
|
||||||
|
add(:id, :uuid, primary_key: true, autogenerated: true)
|
||||||
|
add(:chat_id, references(:chats, type: :uuid, on_delete: :delete_all), null: false)
|
||||||
|
add(:object_id, references(:objects, on_delete: :delete_all), null: false)
|
||||||
|
add(:unread, :boolean, default: true, null: false)
|
||||||
|
timestamps()
|
||||||
|
end
|
||||||
|
|
||||||
|
create(index(:chat_message_references, [:chat_id, "id desc"]))
|
||||||
|
create(unique_index(:chat_message_references, [:object_id, :chat_id]))
|
||||||
|
|
||||||
|
create(
|
||||||
|
index(:chat_message_references, [:chat_id],
|
||||||
|
where: "unread = true",
|
||||||
|
name: "unread_messages_count_index"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
|
@ -371,8 +371,6 @@ test "We don't have unexpected tables which may contain objects that are referen
|
||||||
["apps"],
|
["apps"],
|
||||||
["backups"],
|
["backups"],
|
||||||
["bookmarks"],
|
["bookmarks"],
|
||||||
["chat_message_references"],
|
|
||||||
["chats"],
|
|
||||||
["config"],
|
["config"],
|
||||||
["conversation_participation_recipient_ships"],
|
["conversation_participation_recipient_ships"],
|
||||||
["conversation_participations"],
|
["conversation_participations"],
|
||||||
|
|
Loading…
Reference in a new issue