-- name: SelectSitesOwnedByUser :many
SELECT * FROM sites WHERE owner_id = ? ORDER BY title ASC;

-- name: SelectSiteByID :one
SELECT * FROM sites WHERE id = ?;

-- name: InsertSite :one
INSERT INTO sites (
    owner_id,
    title,
    tagline,
    created_at
) VALUES (?, ?, ?, ?)
RETURNING id;

-- name: HasUsersAndSites :one
SELECT (SELECT COUNT(*) FROM users) > 0 AND (SELECT COUNT(*) FROM sites) > 0 AS has_users_and_sites;