Files
OwnCord/Server/db/queries/sqlite/blocks.sql
T
J3vb 2a46b95111 feat: adopt sqlc for type-safe database access (Phase A Step 2)
- Add sqlc.yaml config (SQLite engine, db/queries/sqlite/, db/dbgen/ output)
- Pin sqlc v1.30.0 in sqlc.version
- Add Makefile with sqlc-install, sqlc-generate, sqlc-verify targets
- Write 14 SQL query files covering all DB domains (users, sessions,
  invites, channels, messages, reactions, voice, roles, attachments,
  admin, dm, blocks, lockouts, profile)
- Commit generated db/dbgen/ package (querier interface + typed fns)
- FTS5 search queries remain hand-written in message_queries.go;
  transactional multi-step operations unchanged in Go
2026-04-06 09:12:59 +02:00

15 lines
442 B
SQL

-- name: BlockUser :exec
INSERT OR IGNORE INTO user_blocks (blocker_id, blocked_id) VALUES (?, ?);
-- name: UnblockUser :exec
DELETE FROM user_blocks WHERE blocker_id = ? AND blocked_id = ?;
-- name: IsBlocked :one
SELECT 1 FROM user_blocks WHERE blocker_id = ? AND blocked_id = ? LIMIT 1;
-- name: IsEitherBlocked :one
SELECT 1 FROM user_blocks
WHERE (blocker_id = ? AND blocked_id = ?)
OR (blocker_id = ? AND blocked_id = ?)
LIMIT 1;