Switch to storing Git repositories in a table
Rather than just storing the URL in the guix_revisions and load_new_guix_revision_jobs tables. This will help when storing more information like tags and branches in the future.
This commit is contained in:
parent
051962b54d
commit
ce4c3c6ed3
12 changed files with 246 additions and 77 deletions
|
|
@ -25,21 +25,22 @@
|
|||
id)
|
||||
(() #f)))
|
||||
|
||||
(define (insert-guix-revision conn url commit store_path)
|
||||
(define (insert-guix-revision conn git-repository-id commit store_path)
|
||||
(define insert
|
||||
(string-append "INSERT INTO guix_revisions "
|
||||
"(url, commit, store_path) VALUES "
|
||||
"('" url "', '"
|
||||
"(git_repository_id, commit, store_path) VALUES "
|
||||
"(" git-repository-id ", '"
|
||||
commit "', '"
|
||||
store_path "') "
|
||||
"RETURNING id;"))
|
||||
|
||||
(map car (exec-query conn insert)))
|
||||
|
||||
(define (guix-revision-exists? conn url commit)
|
||||
(define (guix-revision-exists? conn git-repository-id commit)
|
||||
(define query
|
||||
(string-append "SELECT EXISTS("
|
||||
"SELECT 1 FROM guix_revisions WHERE url = '" url "' "
|
||||
"SELECT 1 FROM guix_revisions WHERE "
|
||||
"git_repository_id = '" git-repository-id "' "
|
||||
"AND commit = '" commit "')"
|
||||
";"))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue