How about a badge awarded to posts that contain attachments? What sql query would accomplish that?
Depends on what about those posts you’re after. Basically a post with an attachment is generally one with a picture in, so something like:
SELECT user_id
FROM posts
WHERE raw ilike '%<img src="%"'
would probably be a good start.
1 Like
https://meta.discourse.org/t/what-cool-badge-queries-have-you-come-up-with/18978/23?u=mochabcha
I get a message of
An error occurred: Contract violation: Query does not return a 'granted_at' column
when trying that one.
Change the beginning to one of the following:
SELECT user_id, current_timestamp granted_at
SELECT user_id, post.created_at granted_at
SELECT user_id, post.updated_at granted_at
Remember that bronze badges not “granted_at” the last ~48 hours will not give a notification.