projects
/
brackets.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
77e8096
)
Fix genre IDs changing on re-encounter
author
Jacob Casper
<dev@jacobcasper.com>
Thu, 16 Apr 2020 22:19:14 +0000
(17:19 -0500)
committer
Jacob Casper
<dev@jacobcasper.com>
Fri, 17 Apr 2020 00:20:10 +0000
(19:20 -0500)
routes/artist/artist.go
patch
|
blob
|
blame
|
history
diff --git
a/routes/artist/artist.go
b/routes/artist/artist.go
index
cc09563
..
09788ad
100644
(file)
--- 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("
REPLAC
E INTO GENRE (NAME) VALUES (?)", genre)
+ result, err := env.Db.Db.Exec("
INSERT OR IGNOR
E 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)