From 47d8493fa8fc92295ad04b93ab38bca70b8b6dc2 Mon Sep 17 00:00:00 2001 From: Jacob Casper Date: Thu, 16 Apr 2020 17:19:14 -0500 Subject: [PATCH] Fix genre IDs changing on re-encounter --- routes/artist/artist.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routes/artist/artist.go b/routes/artist/artist.go index cc09563..09788ad 100644 --- a/routes/artist/artist.go +++ b/routes/artist/artist.go @@ -95,7 +95,7 @@ func Add(env *env.Env) routes.Handler { env.Db.Db.Exec("INSERT INTO ARTIST (ID, NAME) VALUES (?, ?)", artist.ID, artist.Name) for _, genre := range artist.Genres { - result, err := env.Db.Db.Exec("REPLACE INTO GENRE (NAME) VALUES (?)", genre) + result, err := env.Db.Db.Exec("INSERT OR IGNORE INTO GENRE (NAME) VALUES (?)", genre) if err != nil { log.Printf("Failed to insert genre %s: %s", genre, err.Error()) http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) -- 2.20.1