Drop Chat tables
ci/woodpecker/pr/lint Pipeline was successful Details
ci/woodpecker/pr/test Pipeline was successful Details
ci/woodpecker/pr/build-amd64 Pipeline was successful Details
ci/woodpecker/pr/build-arm64 Pipeline was successful Details
ci/woodpecker/pr/docs Pipeline was successful Details

Chats were removed in 0f132b802d
This commit is contained in:
Oneric 2024-02-11 02:02:24 +01:00
parent 5f7d47dcb7
commit 8cf183cb42
2 changed files with 50 additions and 2 deletions

View 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

View File

@ -371,8 +371,6 @@ defmodule Mix.Tasks.Pleroma.DatabaseTest do
["apps"],
["backups"],
["bookmarks"],
["chat_message_references"],
["chats"],
["config"],
["conversation_participation_recipient_ships"],
["conversation_participations"],