From e0c165ff1eab9506be75906c33c5b38c854ec704 Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Thu, 21 Sep 2023 18:55:48 -0400 Subject: [PATCH] Ensure SetCollectionAttribute also updates attributes Previously, it would only INSERT. --- database.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database.go b/database.go index f2a87dc..6b178bf 100644 --- a/database.go +++ b/database.go @@ -2274,7 +2274,7 @@ func (db *datastore) GetCollectionAttribute(id int64, attr string) string { } func (db *datastore) SetCollectionAttribute(id int64, attr, v string) error { - _, err := db.Exec("INSERT INTO collectionattributes (collection_id, attribute, value) VALUES (?, ?, ?)", id, attr, v) + _, err := db.Exec("INSERT INTO collectionattributes (collection_id, attribute, value) VALUES (?, ?, ?) "+db.upsert("collection_id", "attribute")+" value = ?", id, attr, v, v) if err != nil { log.Error("Unable to INSERT into collectionattributes: %v", err) return err