Something went wrong. Try again.
(READ ONLY) Margin is an open annotation layer for the internet. Powered by the AT Protocol.
margin.at
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849-- name: CreateReply :execINSERT INTO replies (uri, author_did, parent_uri, root_uri, text, format, created_at, indexed_at, cid)VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)ON CONFLICT(uri) DO UPDATE SET text = EXCLUDED.text, format = EXCLUDED.format, indexed_at = EXCLUDED.indexed_at, cid = EXCLUDED.cid;
-- name: GetRepliesByRoot :manySELECT uri, author_did, parent_uri, root_uri, text, format, created_at, indexed_at, cidFROM repliesWHERE root_uri = $1ORDER BY created_at ASC;
-- name: GetReplyByURI :oneSELECT uri, author_did, parent_uri, root_uri, text, format, created_at, indexed_at, cidFROM repliesWHERE uri = $1;
-- name: DeleteReply :execDELETE FROM replies WHERE uri = $1;
-- name: GetRepliesByAuthor :manySELECT uri, author_did, parent_uri, root_uri, text, format, created_at, indexed_at, cidFROM repliesWHERE author_did = $1ORDER BY created_at DESC;
-- name: GetOrphanedRepliesByAuthor :manySELECT r.uri, r.author_did, r.parent_uri, r.root_uri, r.text, r.format, r.created_at, r.indexed_at, r.cidFROM replies rLEFT JOIN annotations a ON r.root_uri = a.uriWHERE r.author_did = $1 AND a.uri IS NULL;
-- name: GetReplyCount :oneSELECT COUNT(*) FROM replies WHERE root_uri = $1;
-- name: GetReplyCounts :manySELECT root_uri, COUNT(*)FROM repliesWHERE root_uri = ANY($1::text[])GROUP BY root_uri;
-- name: GetRepliesByURIs :manySELECT uri, author_did, parent_uri, root_uri, text, format, created_at, indexed_at, cidFROM repliesWHERE uri = ANY($1::text[]);