diff --git a/src/twitch/twitch.go b/src/twitch/twitch.go index bb8d800..698ebbf 100644 --- a/src/twitch/twitch.go +++ b/src/twitch/twitch.go @@ -774,7 +774,6 @@ func fetchLatestStreamStatus(ctx context.Context, conn db.ConnOrTx, twitchID str result = &models.TwitchLatestStatus{ TwitchID: twitchID, TwitchLogin: twitchLogin, - Tags: make([]string, 0), } } else if err != nil { return nil, oops.New(err, "failed to fetch existing twitch status") @@ -815,6 +814,10 @@ func saveLatestStreamStatus(ctx context.Context, conn db.ConnOrTx, latest *model return err } + if latest.Tags == nil { + latest.Tags = make([]string, 0) + } + _, err = conn.Exec(ctx, ` UPDATE twitch_latest_status @@ -874,7 +877,6 @@ func updateStreamHistory(ctx context.Context, dbConn db.ConnOrTx, status *models if err == db.NotFound { history = &models.TwitchStreamHistory{} - history.Tags = make([]string, 0) history.StreamID = status.StreamID history.TwitchID = status.TwitchID history.TwitchLogin = status.TwitchLogin @@ -894,6 +896,10 @@ func updateStreamHistory(ctx context.Context, dbConn db.ConnOrTx, status *models history.CategoryID = status.CategoryID history.Tags = status.Tags + if history.Tags == nil { + history.Tags = make([]string, 0) + } + _, err = tx.Exec(ctx, ` INSERT INTO