Subject: [bug#31755] [PATCH 10/19] database: Replace existing entries in Refs.

From: Ludovic Courtès <[email-masked]>
Date: Fri, 8 Jun 2018 11:34:42 +0200

* guix/store/database.scm (add-reference-sql): Add "OR REPLACE".
---
 guix/store/database.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/guix/store/database.scm b/guix/store/database.scm
index bfd2c3626..094dea3ec 100644
--- a/guix/store/database.scm
+++ b/guix/store/database.scm
@@ -141,7 +141,7 @@ of course. Returns the row id of the row that was modified or inserted."
           (last-insert-row-id db)))))
 
 (define add-reference-sql
-  "INSERT INTO Refs (referrer, reference) VALUES (:referrer, :reference);")
+  "INSERT OR REPLACE INTO Refs (referrer, reference) VALUES (:referrer, :reference);")
 
 (define (add-references db referrer references)
   "REFERRER is the id of the referring store item, REFERENCES is a list
-- 
2.17.1