diff --git a/litecord/storage.py b/litecord/storage.py index c42977d..d4dbae3 100644 --- a/litecord/storage.py +++ b/litecord/storage.py @@ -803,6 +803,10 @@ class Storage: # if author_id is None, we fetch webhook info # from the message_webhook_info table. if author_id is None: + # webhook information in a message when made by a webhook + # is copied from the webhook table, or inserted by the webhook + # itself. this causes a complete disconnect from the messages + # table into the webhooks table. wb_info = await self.db.fetchrow(""" SELECT webhook_id, name, avatar FROM message_webhook_info diff --git a/manage/cmd/migration/16_messages_webhooks.sql b/manage/cmd/migration/scripts/16_messages_webhooks.sql similarity index 76% rename from manage/cmd/migration/16_messages_webhooks.sql rename to manage/cmd/migration/scripts/16_messages_webhooks.sql index 91aaad2..fc8ba66 100644 --- a/manage/cmd/migration/16_messages_webhooks.sql +++ b/manage/cmd/migration/scripts/16_messages_webhooks.sql @@ -1,9 +1,9 @@ -- this is a tricky one. blame discord --- first, remove all messages made by webhooks +-- first, remove all messages made by webhooks (safety check) DELETE FROM messages WHERE author_id is null; --- delete the row, removing the fkey. no connection anymore. +-- delete the column, removing the fkey. no connection anymore. ALTER TABLE messages DROP COLUMN webhook_id; -- add a message_webhook_info table. more on that in Storage._inject_author