16_messages_webhooks.sql: fix comments

- storage: add explanation for wb_info
This commit is contained in:
Luna 2019-03-18 23:00:16 -03:00
parent 02c6741d74
commit dab830066b
2 changed files with 6 additions and 2 deletions

View File

@ -803,6 +803,10 @@ class Storage:
# if author_id is None, we fetch webhook info # if author_id is None, we fetch webhook info
# from the message_webhook_info table. # from the message_webhook_info table.
if author_id is None: 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(""" wb_info = await self.db.fetchrow("""
SELECT webhook_id, name, avatar SELECT webhook_id, name, avatar
FROM message_webhook_info FROM message_webhook_info

View File

@ -1,9 +1,9 @@
-- this is a tricky one. blame discord -- 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 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; ALTER TABLE messages DROP COLUMN webhook_id;
-- add a message_webhook_info table. more on that in Storage._inject_author -- add a message_webhook_info table. more on that in Storage._inject_author