In what table are bookmarks stored, if not “bookmarks”?

The bookmarks table doesn’t seem to be getting used yet. It is part of some improvements that are being made to Discourse’s bookmarking functionality.

Currenty, you can get information about bookmarks with a query like this:

SELECT
t.user_id,
t.id AS topic_id,
COUNT(*) AS bookmark_count
FROM post_actions pa
JOIN posts p
ON p.id = pa.post_id
JOIN topics t
ON t.id = p.topic_id
WHERE pa.post_action_type_id = 1
AND t.deleted_at IS NULL
AND p.deleted_at IS NULL
GROUP BY t.id, t.user_id
ORDER BY bookmark_count DESC
LIMIT 20
7 Likes