Files
MealQuest/migrations/queries/photos.sql
T
dev_agent 17a69f4de7
CI / ci (push) Successful in 1m25s
CI / ci (pull_request) Successful in 1m24s
Independent review Codex gpt-6-sol high: CHANGES_REQUIRED (4 medium)
Feature 02 task 4: sqlc configuration and core queries (#13)
Co-authored-by: dev_agent <dev_agent@cubecraftlabs.com>
Co-committed-by: dev_agent <dev_agent@cubecraftlabs.com>
2026-10-03 09:15:40 -04:00

18 lines
423 B
SQL

-- name: CreatePhoto :one
INSERT INTO photos (
id, source_url, local_path, width, height, sha256, fetched_at,
created_at, updated_at
) VALUES (
?, ?, ?, ?, ?, ?, ?,
?, ?
)
RETURNING *;
-- name: GetPhotoBySHA256 :one
-- Finds stored image bytes by content hash. The schema does not make sha256
-- unique, so the earliest-created (lowest id) match is returned.
SELECT * FROM photos
WHERE sha256 = ?
ORDER BY id
LIMIT 1;