|
@@ -209,11 +209,12 @@ func (db *DB) UpdatePlaylistBySection(sectionName string, tracks []string) (bool
|
209
|
209
|
return false, err
|
210
|
210
|
}
|
211
|
211
|
query := `
|
212
|
|
- INSERT INTO public.round_playlist pl
|
213
|
|
- SELECT r.id, json_to_array($2)
|
|
212
|
+ INSERT INTO public.round_playlist
|
|
213
|
+ SELECT r.id, ARRAY(SELECT e::text FROM json_array_elements($2::json) e)
|
214
|
214
|
FROM public.round r
|
215
|
215
|
WHERE r.section = $1
|
216
|
|
- ON CONFLICT (pl.round_id) DO UPDATE SET tracks = EXCLUDED.tracks`
|
|
216
|
+ ON CONFLICT (round_id) DO UPDATE SET tracks = EXCLUDED.tracks`
|
|
217
|
+
|
217
|
218
|
res, err := db.database.Exec(query, sectionName, tracksJson)
|
218
|
219
|
|
219
|
220
|
if err != nil {
|