SELECT
owner,
name
FROM
github_repository;
INSERT INTO
github_project (
org,
number,
title,
description,
url,
closed,
category,
category_reasoning,
updated_at
)
VALUES
($1, $2, $3, $4, $5, $6, $7, $8, NOW()) ON CONFLICT (org, number) DO
UPDATE
SET
title = EXCLUDED.title,
description = EXCLUDED.description,
url = EXCLUDED.url,
closed = EXCLUDED.closed,
category = COALESCE(
EXCLUDED.category,
github_project.category
),
category_reasoning = COALESCE(
EXCLUDED.category_reasoning,
github_project.category_reasoning
),
updated_at = NOW();
SELECT
org,
number,
title,
description,
url,
closed,
category,
category_reasoning,
updated_at
FROM
github_project
WHERE
org = $1
AND closed = false
ORDER BY
number;
SELECT
org,
number,
title,
description,
url,
closed,
category,
category_reasoning,
updated_at
FROM
github_project
WHERE
org = @org
AND closed = false
AND category = @category
ORDER BY
number;
SELECT
org,
number,
title,
description,
url,
closed,
category,
category_reasoning,
updated_at
FROM
github_project
WHERE
org = $1
AND number = $2;
SELECT
org,
number,
title,
description,
url,
closed,
category,
category_reasoning,
updated_at
FROM
github_project
WHERE
org = $1
ORDER BY
number;
SELECT
org,
number,
title,
description,
url,
closed,
category,
category_reasoning,
updated_at
FROM
github_project
WHERE
org = $1
AND closed = false
AND category IS NULL
ORDER BY
number;