diff --git a/resources/sql/queries.sql b/resources/sql/queries.sql index 6b9c464..0bf1a46 100644 --- a/resources/sql/queries.sql +++ b/resources/sql/queries.sql @@ -101,11 +101,12 @@ RETURNING repo_id, issue_id, issue_number, title, address, commit_id; -- :name create-pull-request! :! :n -- :doc creates pull request -INSERT INTO pull_requests (repo_id, pr_id, pr_number, commit_id, user_id) +INSERT INTO pull_requests (repo_id, pr_id, pr_number, issue_number, commit_id, user_id) SELECT :repo_id, :pr_id, :pr_number, + :issue_number, :commit_id, :user_id WHERE NOT exists(SELECT 1