-- pending_messages: offline message queue. A text message to a device with no live -- SSE connection is queued here and delivered once when that device next polls. -- NOTE: keep this file pure ASCII; sqlc v1.31.1 drifts byte offsets on multibyte -- runes in query files, corrupting the generated SQL. -- name: InsertPendingMessage :exec INSERT INTO pending_messages (id, user_id, to_device, from_device, text, sent_at, created_at, expires_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?); -- name: PopPendingMessages :many DELETE FROM pending_messages WHERE user_id = ? AND to_device = ? RETURNING id, user_id, to_device, from_device, text, sent_at, created_at, expires_at; -- name: DeleteExpiredPendingMessages :exec DELETE FROM pending_messages WHERE expires_at < ?;