add 15_drop_nullable_webhook_avatar.sql

- webhooks: quickfix to webhook_check
This commit is contained in:
Luna 2019-03-18 04:54:23 -03:00
parent 712f1d9ff2
commit e8c158da81
3 changed files with 4 additions and 2 deletions

View File

@ -73,7 +73,7 @@ async def get_webhook(webhook_id: int, *,
async def _webhook_check(channel_id): async def _webhook_check(channel_id):
user_id = await token_check() user_id = await token_check()
await channel_check(user_id, channel_id, ChannelType.GUILD_TEXT) await channel_check(user_id, channel_id, only=ChannelType.GUILD_TEXT)
await channel_perm_check(user_id, channel_id, 'manage_webhooks') await channel_perm_check(user_id, channel_id, 'manage_webhooks')
return user_id return user_id

View File

@ -0,0 +1,2 @@
ALTER TABLE webhooks ALTER COLUMN avatar DROP NOT NULL;
ALTER TABLE webhooks ALTER COLUMN avatar SET DEFAULT NULL;

View File

@ -542,7 +542,7 @@ CREATE TABLE IF NOT EXISTS webhooks (
creator_id bigint REFERENCES users (id), creator_id bigint REFERENCES users (id),
name text NOT NULL, name text NOT NULL,
avatar text NOT NULL, avatar text DEFAULT NULL,
-- Yes, we store the webhook's token -- Yes, we store the webhook's token
-- since they aren't users and there's no /api/login for them. -- since they aren't users and there's no /api/login for them.