/** * SQL guard for `repos.open_issues_count` / `open_pulls_count` updates: the issue bound as the guard's parameter is * not hidden. Hiding an open issue already took it out of the counter, so later state changes must not move it. */ export const COUNTED = "NOT EXISTS (SELECT 1 FROM issues WHERE id = ? AND hidden_at IS NOT NULL)"; /** 1 when the comment bound as the parameter exists and is not hidden, else 0: what deleting it takes off a count. */ export const VISIBLE_COMMENT = "(SELECT COUNT(*) FROM comments WHERE id = ? AND hidden_at IS NULL)";