Fix how email dates are inserted in to PostgreSQL
Previously, the timezone was stripped off, so the timestamps were off. This commit changes the code to use a Unix timestamp, which avoids this issue.
This commit is contained in:
parent
16799a34a9
commit
e6effe7556
3 changed files with 5 additions and 4 deletions
|
|
@ -53,7 +53,7 @@
|
||||||
"NULL"
|
"NULL"
|
||||||
x-git-newrev)
|
x-git-newrev)
|
||||||
git-repository-id
|
git-repository-id
|
||||||
(date->string date "~4"))
|
date)
|
||||||
|
|
||||||
(unless (string=? "0000000000000000000000000000000000000000"
|
(unless (string=? "0000000000000000000000000000000000000000"
|
||||||
x-git-newrev)
|
x-git-newrev)
|
||||||
|
|
|
||||||
|
|
@ -13,12 +13,12 @@
|
||||||
conn
|
conn
|
||||||
(string-append
|
(string-append
|
||||||
"INSERT INTO git_branches (name, commit, git_repository_id, datetime) "
|
"INSERT INTO git_branches (name, commit, git_repository_id, datetime) "
|
||||||
"VALUES ($1, $2, $3, $4) "
|
"VALUES ($1, $2, $3, to_timestamp($4)) "
|
||||||
"ON CONFLICT DO NOTHING")
|
"ON CONFLICT DO NOTHING")
|
||||||
(list name
|
(list name
|
||||||
commit
|
commit
|
||||||
git-repository-id
|
git-repository-id
|
||||||
datetime)))
|
(date->string datetime "~s"))))
|
||||||
|
|
||||||
(define (git-branches-for-commit conn commit)
|
(define (git-branches-for-commit conn commit)
|
||||||
(define query
|
(define query
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
(define-module (test-model-git-branch)
|
(define-module (test-model-git-branch)
|
||||||
|
#:use-module (srfi srfi-19)
|
||||||
#:use-module (srfi srfi-64)
|
#:use-module (srfi srfi-64)
|
||||||
#:use-module (guix-data-service database)
|
#:use-module (guix-data-service database)
|
||||||
#:use-module (guix-data-service model git-repository)
|
#:use-module (guix-data-service model git-repository)
|
||||||
|
|
@ -18,7 +19,7 @@
|
||||||
"master"
|
"master"
|
||||||
"test-commit"
|
"test-commit"
|
||||||
id
|
id
|
||||||
(strftime "%c" (gmtime (current-time)))))
|
(current-date)))
|
||||||
#t)
|
#t)
|
||||||
#:always-rollback? #t))))
|
#:always-rollback? #t))))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue