Purge leftovers from chats #684

Merged
floatingghost merged 2 commits from Oneric/akkoma:cosmetic-purge-chat into develop 2024-02-13 09:13:38 +00:00
Member

All of the functionality was already gutted in 0f132b802d but some (now unused) config settings and the two tables were left. (There already are no more references to disableChat or :shout in the config cheatsheet)

I confirmed the migration successfully applies both ways

This cleanup is mostly cosmetic — unless someone migrated from Pleroma and still has data stored in the tables. In this case some space will be reclaimed. I guess in theory this may be data loss if later migrating back to Pleroma, but if really desired a backup can be made before

EDIT: if this gets merged before #674 , the migration id in #674 will need to be bumped to avoid confusing Ecto


For reference these are the table schema before (and also after reverting) the migration

akkoma=> \d+ chat_message_references
                                               Table "public.chat_message_references"
   Column    |              Type              | Collation | Nullable | Default | Storage | Compression | Stats target | Description 
-------------+--------------------------------+-----------+----------+---------+---------+-------------+--------------+-------------
 id          | uuid                           |           | not null |         | plain   |             |              | 
 chat_id     | uuid                           |           | not null |         | plain   |             |              | 
 object_id   | bigint                         |           | not null |         | plain   |             |              | 
 inserted_at | timestamp(0) without time zone |           | not null |         | plain   |             |              | 
 updated_at  | timestamp(0) without time zone |           | not null |         | plain   |             |              | 
 unread      | boolean                        |           | not null | true    | plain   |             |              | 
Indexes:
    "chat_message_references_pkey" PRIMARY KEY, btree (id)
    "chat_message_references_chat_id_id_desc_index" btree (chat_id, id DESC)
    "chat_message_references_object_id_chat_id_index" UNIQUE, btree (object_id, chat_id)
    "unread_messages_count_index" btree (chat_id) WHERE unread = true
Foreign-key constraints:
    "chat_message_references_chat_id_fkey" FOREIGN KEY (chat_id) REFERENCES chats(id) ON DELETE CASCADE
    "chat_message_references_object_id_fkey" FOREIGN KEY (object_id) REFERENCES objects(id) ON DELETE CASCADE
Access method: heap

akkoma=> \d+ chats
                                                        Table "public.chats"
   Column    |              Type              | Collation | Nullable | Default | Storage  | Compression | Stats target | Description 
-------------+--------------------------------+-----------+----------+---------+----------+-------------+--------------+-------------
 id          | uuid                           |           | not null |         | plain    |             |              | 
 user_id     | uuid                           |           |          |         | plain    |             |              | 
 recipient   | character varying(255)         |           |          |         | extended |             |              | 
 inserted_at | timestamp(0) without time zone |           | not null |         | plain    |             |              | 
 updated_at  | timestamp(0) without time zone |           | not null |         | plain    |             |              | 
Indexes:
    "chats_pkey" PRIMARY KEY, btree (id)
    "chats_user_id_recipient_index" UNIQUE, btree (user_id, recipient)
Foreign-key constraints:
    "chats_recipient_fkey" FOREIGN KEY (recipient) REFERENCES users(ap_id) ON DELETE CASCADE
    "chats_user_id_fkey" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
Referenced by:
    TABLE "chat_message_references" CONSTRAINT "chat_message_references_chat_id_fkey" FOREIGN KEY (chat_id) REFERENCES chats(id) ON DELETE CASCADE
Access method: heap
All of the functionality was already gutted in 0f132b802dde7f217ecb07767e0d34e3edb517b7 but some (now unused) config settings and the two tables were left. (There already are no more references to `disableChat` or `:shout` in the config cheatsheet) I confirmed the migration successfully applies both ways This cleanup is mostly cosmetic — unless someone migrated from Pleroma and still has data stored in the tables. In this case some space will be reclaimed. I guess in theory this may be data loss if later migrating back to Pleroma, but if really desired a backup can be made before **EDIT:** if this gets merged before #674 , the migration id in #674 will need to be bumped to avoid confusing Ecto -------- For reference these are the table schema before (and also after reverting) the migration ``` akkoma=> \d+ chat_message_references Table "public.chat_message_references" Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description -------------+--------------------------------+-----------+----------+---------+---------+-------------+--------------+------------- id | uuid | | not null | | plain | | | chat_id | uuid | | not null | | plain | | | object_id | bigint | | not null | | plain | | | inserted_at | timestamp(0) without time zone | | not null | | plain | | | updated_at | timestamp(0) without time zone | | not null | | plain | | | unread | boolean | | not null | true | plain | | | Indexes: "chat_message_references_pkey" PRIMARY KEY, btree (id) "chat_message_references_chat_id_id_desc_index" btree (chat_id, id DESC) "chat_message_references_object_id_chat_id_index" UNIQUE, btree (object_id, chat_id) "unread_messages_count_index" btree (chat_id) WHERE unread = true Foreign-key constraints: "chat_message_references_chat_id_fkey" FOREIGN KEY (chat_id) REFERENCES chats(id) ON DELETE CASCADE "chat_message_references_object_id_fkey" FOREIGN KEY (object_id) REFERENCES objects(id) ON DELETE CASCADE Access method: heap akkoma=> \d+ chats Table "public.chats" Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description -------------+--------------------------------+-----------+----------+---------+----------+-------------+--------------+------------- id | uuid | | not null | | plain | | | user_id | uuid | | | | plain | | | recipient | character varying(255) | | | | extended | | | inserted_at | timestamp(0) without time zone | | not null | | plain | | | updated_at | timestamp(0) without time zone | | not null | | plain | | | Indexes: "chats_pkey" PRIMARY KEY, btree (id) "chats_user_id_recipient_index" UNIQUE, btree (user_id, recipient) Foreign-key constraints: "chats_recipient_fkey" FOREIGN KEY (recipient) REFERENCES users(ap_id) ON DELETE CASCADE "chats_user_id_fkey" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE Referenced by: TABLE "chat_message_references" CONSTRAINT "chat_message_references_chat_id_fkey" FOREIGN KEY (chat_id) REFERENCES chats(id) ON DELETE CASCADE Access method: heap ```
Oneric added 2 commits 2024-02-11 04:19:21 +00:00
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
8cf183cb42
Drop Chat tables
Chats were removed in 0f132b802d

so long chats o7

thanks!

so long chats o7 thanks!
floatingghost merged commit 6fde75e1f0 into develop 2024-02-13 09:13:38 +00:00
Oneric deleted branch cosmetic-purge-chat 2024-02-13 14:32:06 +00:00
Sign in to join this conversation.
No description provided.