-- name: SelectUploadsOfSite :many
SELECT * FROM uploads WHERE site_id = ? ORDER BY created_at DESC;

-- name: SelectUploadByID :one
SELECT * FROM uploads WHERE id = ?;

-- name: InsertUpload :exec
INSERT INTO uploads (
    site_id,
    guid,
    mime_type,
    filename,
    created_at,
    alt
) VALUES (?, ?, ?, ?, ?, ?)
RETURNING id;

-- name: UpdateUpload :exec
UPDATE uploads SET alt = ? WHERE id = ?;

-- name: DeleteUpload :exec
DELETE FROM uploads WHERE id = ?;